Skip to content

Commit 8565e64

Browse files
authored
Merge branch 'main' into main
2 parents 39b91b0 + 029e2db commit 8565e64

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

src/search.rs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -103,16 +103,17 @@ fn serialize_attributes_to_crop_with_wildcard<S: Serializer>(
103103
match data {
104104
Some(Selectors::All) => ["*"].serialize(s),
105105
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<_>>();
116117
results.serialize(s)
117118
}
118119
None => s.serialize_none(),

0 commit comments

Comments
 (0)