File tree Expand file tree Collapse file tree 1 file changed +11
-10
lines changed Expand file tree Collapse file tree 1 file changed +11
-10
lines changed Original file line number Diff line number Diff line change @@ -103,16 +103,17 @@ fn serialize_attributes_to_crop_with_wildcard<S: Serializer>(
103
103
match data {
104
104
Some ( Selectors :: All ) => [ "*" ] . serialize ( s) ,
105
105
Some ( Selectors :: Some ( data) ) => {
106
- let mut results = Vec :: new ( ) ;
107
- for ( name, value) in data. iter ( ) {
108
- let mut result = String :: new ( ) ;
109
- result. push_str ( name) ;
110
- if let Some ( value) = value {
111
- result. push ( ':' ) ;
112
- result. push_str ( value. to_string ( ) . as_str ( ) ) ;
113
- }
114
- results. push ( result) ;
115
- }
106
+ let results = data
107
+ . iter ( )
108
+ . map ( |( name, value) | {
109
+ let mut result = name. to_string ( ) ;
110
+ if let Some ( value) = value {
111
+ result. push ( ':' ) ;
112
+ result. push_str ( value. to_string ( ) . as_str ( ) ) ;
113
+ }
114
+ result
115
+ } )
116
+ . collect :: < Vec < _ > > ( ) ;
116
117
results. serialize ( s)
117
118
}
118
119
None => s. serialize_none ( ) ,
You can’t perform that action at this time.
0 commit comments