Skip to content

Commit 02bde08

Browse files
committed
Use for_each
1 parent 14e0964 commit 02bde08

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/group_map.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ pub fn into_group_map<I, K, V>(iter: I) -> HashMap<K, Vec<V>>
1414
{
1515
let mut lookup = HashMap::new();
1616

17-
for (key, val) in iter {
17+
iter.for_each(|(key, val)| {
1818
lookup.entry(key).or_insert_with(Vec::new).push(val);
19-
}
19+
});
2020

2121
lookup
2222
}

src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1778,10 +1778,10 @@ pub trait Itertools : Iterator {
17781778
let (lower, _) = self.size_hint();
17791779
let mut result = String::with_capacity(sep.len() * lower);
17801780
write!(&mut result, "{}", first_elt).unwrap();
1781-
for elt in self {
1781+
self.for_each(|elt| {
17821782
result.push_str(sep);
17831783
write!(&mut result, "{}", elt).unwrap();
1784-
}
1784+
});
17851785
result
17861786
}
17871787
}

0 commit comments

Comments
 (0)