Skip to content

Commit 37ebee4

Browse files
committed
chore: update format
1 parent 530d98e commit 37ebee4

File tree

4 files changed

+104
-103
lines changed

4 files changed

+104
-103
lines changed

README.md

Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -37,59 +37,59 @@ console.log(optimizedSvg)
3737

3838
## Plugins
3939

40-
- [] ddAttributesToSVGElement
41-
- [] addClassesToSVGElement
42-
- [] cleanupAttrs
43-
- [] cleanupEnableBackground
44-
- [] cleanupIds
45-
- [] cleanupListOfValues
46-
- [] cleanupNumericValues
47-
- [] collapseGroups
48-
- [] convertColors
49-
- [] convertEllipseToCircle
50-
- [] convertOneStopGradients
51-
- [] convertPathData
52-
- [] convertShapeToPath
53-
- [] convertStyleToAttrs
54-
- [] convertTransform
55-
- [] inlineStyles
56-
- [] mergePaths
57-
- [] mergeStyles
58-
- [] minifyStyles
40+
- [ ] ddAttributesToSVGElement
41+
- [ ] addClassesToSVGElement
42+
- [ ] cleanupAttrs
43+
- [ ] cleanupEnableBackground
44+
- [ ] cleanupIds
45+
- [ ] cleanupListOfValues
46+
- [ ] cleanupNumericValues
47+
- [ ] collapseGroups
48+
- [ ] convertColors
49+
- [ ] convertEllipseToCircle
50+
- [ ] convertOneStopGradients
51+
- [ ] convertPathData
52+
- [ ] convertShapeToPath
53+
- [ ] convertStyleToAttrs
54+
- [ ] convertTransform
55+
- [ ] inlineStyles
56+
- [ ] mergePaths
57+
- [ ] mergeStyles
58+
- [ ] minifyStyles
5959
- [x] moveElemsAttrsToGroup
60-
- [] moveGroupAttrsToElems
61-
- [] prefixIds
62-
- [] removeAttributesBySelector
63-
- [] removeAttrs
60+
- [ ] moveGroupAttrsToElems
61+
- [ ] prefixIds
62+
- [ ] removeAttributesBySelector
63+
- [ ] removeAttrs
6464
- [x] removeComments
65-
- [] removeDeprecatedAttrs
65+
- [ ] removeDeprecatedAttrs
6666
- [x] removeDesc
67-
- [] removeDimensions
67+
- [ ] removeDimensions
6868
- [x] removeDoctype
6969
- [x] removeEditorsNSData
70-
- [] removeElementsByAttr
71-
- [] removeEmptyAttrs
72-
- [] removeEmptyContainers
73-
- [] removeEmptyText
74-
- [] removeHiddenElems
70+
- [ ] removeElementsByAttr
71+
- [ ] removeEmptyAttrs
72+
- [ ] removeEmptyContainers
73+
- [ ] removeEmptyText
74+
- [ ] removeHiddenElems
7575
- [x] removeMetadata
76-
- [] removeNonInheritableGroupAttrs
77-
- [] removeOffCanvasPaths
78-
- [] removeRasterImages
79-
- [] removeScripts
80-
- [] removeStyleElement
76+
- [ ] removeNonInheritableGroupAttrs
77+
- [ ] removeOffCanvasPaths
78+
- [ ] removeRasterImages
79+
- [ ] removeScripts
80+
- [ ] removeStyleElement
8181
- [x] removeTitle
82-
- [] removeUnknownsAndDefaults
83-
- [] removeUnusedNS
84-
- [] removeUselessDefs
85-
- [] removeUselessStrokeAndFill
86-
- [] removeViewBox
87-
- [] removeXMLNS
82+
- [ ] removeUnknownsAndDefaults
83+
- [ ] removeUnusedNS
84+
- [ ] removeUselessDefs
85+
- [ ] removeUselessStrokeAndFill
86+
- [ ] removeViewBox
87+
- [ ] removeXMLNS
8888
- [x] removeXMLProcInst
89-
- [] removeXlink
90-
- [] reusePaths
91-
- [] sortAttrs
92-
- [] sortDefsChildren
89+
- [ ] removeXlink
90+
- [ ] reusePaths
91+
- [ ] sortAttrs
92+
- [ ] sortDefsChildren
9393

9494
## Benchmarks
9595

README.zh.md

Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -38,59 +38,59 @@ console.log(optimizedSvg)
3838

3939
## 插件
4040

41-
- [] ddAttributesToSVGElement
42-
- [] addClassesToSVGElement
43-
- [] cleanupAttrs
44-
- [] cleanupEnableBackground
45-
- [] cleanupIds
46-
- [] cleanupListOfValues
47-
- [] cleanupNumericValues
48-
- [] collapseGroups
49-
- [] convertColors
50-
- [] convertEllipseToCircle
51-
- [] convertOneStopGradients
52-
- [] convertPathData
53-
- [] convertShapeToPath
54-
- [] convertStyleToAttrs
55-
- [] convertTransform
56-
- [] inlineStyles
57-
- [] mergePaths
58-
- [] mergeStyles
59-
- [] minifyStyles
41+
- [ ] ddAttributesToSVGElement
42+
- [ ] addClassesToSVGElement
43+
- [ ] cleanupAttrs
44+
- [ ] cleanupEnableBackground
45+
- [ ] cleanupIds
46+
- [ ] cleanupListOfValues
47+
- [ ] cleanupNumericValues
48+
- [ ] collapseGroups
49+
- [ ] convertColors
50+
- [ ] convertEllipseToCircle
51+
- [ ] convertOneStopGradients
52+
- [ ] convertPathData
53+
- [ ] convertShapeToPath
54+
- [ ] convertStyleToAttrs
55+
- [ ] convertTransform
56+
- [ ] inlineStyles
57+
- [ ] mergePaths
58+
- [ ] mergeStyles
59+
- [ ] minifyStyles
6060
- [x] moveElemsAttrsToGroup
61-
- [] moveGroupAttrsToElems
62-
- [] prefixIds
63-
- [] removeAttributesBySelector
64-
- [] removeAttrs
61+
- [ ] moveGroupAttrsToElems
62+
- [ ] prefixIds
63+
- [ ] removeAttributesBySelector
64+
- [ ] removeAttrs
6565
- [x] removeComments
66-
- [] removeDeprecatedAttrs
66+
- [ ] removeDeprecatedAttrs
6767
- [x] removeDesc
68-
- [] removeDimensions
68+
- [ ] removeDimensions
6969
- [x] removeDoctype
7070
- [x] removeEditorsNSData
71-
- [] removeElementsByAttr
72-
- [] removeEmptyAttrs
73-
- [] removeEmptyContainers
74-
- [] removeEmptyText
75-
- [] removeHiddenElems
71+
- [ ] removeElementsByAttr
72+
- [ ] removeEmptyAttrs
73+
- [ ] removeEmptyContainers
74+
- [ ] removeEmptyText
75+
- [ ] removeHiddenElems
7676
- [x] removeMetadata
77-
- [] removeNonInheritableGroupAttrs
78-
- [] removeOffCanvasPaths
79-
- [] removeRasterImages
80-
- [] removeScripts
81-
- [] removeStyleElement
77+
- [ ] removeNonInheritableGroupAttrs
78+
- [ ] removeOffCanvasPaths
79+
- [ ] removeRasterImages
80+
- [ ] removeScripts
81+
- [ ] removeStyleElement
8282
- [x] removeTitle
83-
- [] removeUnknownsAndDefaults
84-
- [] removeUnusedNS
85-
- [] removeUselessDefs
86-
- [] removeUselessStrokeAndFill
87-
- [] removeViewBox
88-
- [] removeXMLNS
83+
- [ ] removeUnknownsAndDefaults
84+
- [ ] removeUnusedNS
85+
- [ ] removeUselessDefs
86+
- [ ] removeUselessStrokeAndFill
87+
- [ ] removeViewBox
88+
- [ ] removeXMLNS
8989
- [x] removeXMLProcInst
90-
- [] removeXlink
91-
- [] reusePaths
92-
- [] sortAttrs
93-
- [] sortDefsChildren
90+
- [ ] removeXlink
91+
- [ ] reusePaths
92+
- [ ] sortAttrs
93+
- [ ] sortDefsChildren
9494

9595
## 基准测试
9696

rustfmt.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1-
tab_spaces = 2
1+
chain_width = 80
2+
edition = "2021"
3+
max_width = 100
4+
remove_nested_parens = true
5+
tab_spaces = 2

src/optimizer.rs

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -91,23 +91,20 @@ impl<'a> SvgOptimizer<'a> {
9191
.plugins
9292
.iter()
9393
.any(|plugin| plugin.comment_enter(el) == VisitAction::Remove),
94-
XMLAstChild::Cdata(el) => self
95-
.plugins
96-
.iter()
97-
.any(|plugin| plugin.cdata_enter(el) == VisitAction::Remove),
98-
XMLAstChild::Text(el) => self
99-
.plugins
100-
.iter()
101-
.any(|plugin| plugin.text_enter(el) == VisitAction::Remove),
94+
XMLAstChild::Cdata(el) => {
95+
self.plugins.iter().any(|plugin| plugin.cdata_enter(el) == VisitAction::Remove)
96+
}
97+
XMLAstChild::Text(el) => {
98+
self.plugins.iter().any(|plugin| plugin.text_enter(el) == VisitAction::Remove)
99+
}
102100
XMLAstChild::Element(el) => self
103101
.plugins
104102
.iter_mut()
105103
.any(|plugin| plugin.element_enter(el) == VisitAction::Remove),
106104
// Assuming Decl nodes are never removed by plugins
107-
XMLAstChild::Decl(el) => self
108-
.plugins
109-
.iter()
110-
.any(|plugin| plugin.decl_enter(el) == VisitAction::Remove),
105+
XMLAstChild::Decl(el) => {
106+
self.plugins.iter().any(|plugin| plugin.decl_enter(el) == VisitAction::Remove)
107+
}
111108
};
112109

113110
if should_remove {

0 commit comments

Comments
 (0)