Skip to content

Commit 2c9315c

Browse files
committed
Use internal iteration in GroupingMap
1 parent ddeb9f1 commit 2c9315c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/grouping_map.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,12 @@ impl<I, K, V> GroupingMap<I>
102102
{
103103
let mut destination_map = HashMap::new();
104104

105-
for (key, val) in self.iter {
105+
self.iter.for_each(|(key, val)| {
106106
let acc = destination_map.remove(&key);
107107
if let Some(op_res) = operation(acc, &key, val) {
108108
destination_map.insert(key, op_res);
109109
}
110-
}
110+
});
111111

112112
destination_map
113113
}
@@ -208,9 +208,9 @@ impl<I, K, V> GroupingMap<I>
208208
{
209209
let mut destination_map = HashMap::new();
210210

211-
for (key, val) in self.iter {
211+
self.iter.for_each(|(key, val)| {
212212
destination_map.entry(key).or_insert_with(C::default).extend(Some(val));
213-
}
213+
});
214214

215215
destination_map
216216
}

0 commit comments

Comments
 (0)