@@ -36,8 +36,8 @@ impl<W: Write> SimplePrettier<W> {
36
36
Self { level : 0 , writer }
37
37
}
38
38
}
39
- impl < W : std:: io:: Write > VisitMut < std:: io:: Result < ( ) > > for SimplePrettier < W > {
40
- fn visit_root ( & mut self , root : & mut Root ) -> std:: io:: Result < ( ) > {
39
+ impl < ' a , W : std:: io:: Write > VisitMut < ' a , std:: io:: Result < ( ) > > for SimplePrettier < W > {
40
+ fn visit_root ( & mut self , root : & mut Root < ' a > ) -> std:: io:: Result < ( ) > {
41
41
for child in root. children . iter_mut ( ) {
42
42
match child {
43
43
RuleOrAtRuleOrDecl :: Rule ( rule) => {
@@ -54,7 +54,7 @@ impl<W: std::io::Write> VisitMut<std::io::Result<()>> for SimplePrettier<W> {
54
54
Ok ( ( ) )
55
55
}
56
56
57
- fn visit_rule ( & mut self , rule : & mut Rule ) -> std:: io:: Result < ( ) > {
57
+ fn visit_rule ( & mut self , rule : & mut Rule < ' a > ) -> std:: io:: Result < ( ) > {
58
58
self . writer . write (
59
59
format ! (
60
60
"{}{} {}\n " ,
@@ -83,7 +83,7 @@ impl<W: std::io::Write> VisitMut<std::io::Result<()>> for SimplePrettier<W> {
83
83
Ok ( ( ) )
84
84
}
85
85
86
- fn visit_at_rule ( & mut self , at_rule : & mut AtRule ) -> std:: io:: Result < ( ) > {
86
+ fn visit_at_rule ( & mut self , at_rule : & mut AtRule < ' a > ) -> std:: io:: Result < ( ) > {
87
87
write ! (
88
88
self . writer,
89
89
"{}{} {} {}\n " ,
@@ -110,7 +110,7 @@ impl<W: std::io::Write> VisitMut<std::io::Result<()>> for SimplePrettier<W> {
110
110
write ! ( self . writer, "{}{}\n " , " " . repeat( self . level * 2 ) , "}" )
111
111
}
112
112
113
- fn visit_declaration ( & mut self , decl : & mut Declaration ) -> std:: io:: Result < ( ) > {
113
+ fn visit_declaration ( & mut self , decl : & mut Declaration < ' a > ) -> std:: io:: Result < ( ) > {
114
114
write ! (
115
115
self . writer,
116
116
"{}{} : {};" ,
@@ -124,8 +124,8 @@ impl<W: std::io::Write> VisitMut<std::io::Result<()>> for SimplePrettier<W> {
124
124
#[ derive( Default ) ]
125
125
struct ReverseProp { }
126
126
127
- impl VisitMut for ReverseProp {
128
- fn visit_root ( & mut self , root : & mut Root ) {
127
+ impl < ' a > VisitMut < ' a > for ReverseProp {
128
+ fn visit_root ( & mut self , root : & mut Root < ' a > ) {
129
129
root. children . iter_mut ( ) . for_each ( |child| match child {
130
130
RuleOrAtRuleOrDecl :: Rule ( rule) => {
131
131
self . visit_rule ( rule) ;
@@ -139,7 +139,7 @@ impl VisitMut for ReverseProp {
139
139
} ) ;
140
140
}
141
141
142
- fn visit_rule ( & mut self , rule : & mut Rule ) {
142
+ fn visit_rule ( & mut self , rule : & mut Rule < ' a > ) {
143
143
rule
144
144
. children
145
145
. iter_mut ( )
@@ -156,7 +156,7 @@ impl VisitMut for ReverseProp {
156
156
} ) ;
157
157
}
158
158
159
- fn visit_at_rule ( & mut self , at_rule : & mut AtRule ) {
159
+ fn visit_at_rule ( & mut self , at_rule : & mut AtRule < ' a > ) {
160
160
at_rule
161
161
. children
162
162
. iter_mut ( )
@@ -173,7 +173,7 @@ impl VisitMut for ReverseProp {
173
173
} ) ;
174
174
}
175
175
176
- fn visit_declaration ( & mut self , decl : & mut Declaration ) {
176
+ fn visit_declaration ( & mut self , decl : & mut Declaration < ' a > ) {
177
177
decl. prop . content = Cow :: Owned ( decl. prop . content . chars ( ) . rev ( ) . collect ( ) ) ;
178
178
}
179
179
}
0 commit comments