Skip to content

Commit 7cf4af6

Browse files
committed
Improve brevity+elegance
at the cost of greater reliance on compiler optimizations.
1 parent 20b7f57 commit 7cf4af6

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/lib.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3074,9 +3074,7 @@ pub trait Itertools : Iterator {
30743074
K: Eq + Hash,
30753075
F: FnMut(Self::Item) -> K,
30763076
{
3077-
let mut counts = HashMap::new();
3078-
self.for_each(|item| *counts.entry(f(item)).or_default() += 1);
3079-
counts
3077+
self.map(f).counts()
30803078
}
30813079
}
30823080

0 commit comments

Comments
 (0)