Skip to content

Commit 943a336

Browse files
committed
fn new_map_for_grouping as free function
1 parent 3de4e6c commit 943a336

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

src/grouping_map.rs

+4-6
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,10 @@ impl<V, K, F: FnMut(&V) -> K> MapSpecialCaseFn<V> for GroupingMapFn<F> {
2727
}
2828
}
2929

30-
impl<K, I: Iterator, F: FnMut(&I::Item) -> K> MapForGrouping<I, F> {
31-
pub(crate) fn new(iter: I, key_mapper: F) -> Self {
32-
MapSpecialCase {
33-
iter,
34-
f: GroupingMapFn(key_mapper),
35-
}
30+
pub(crate) fn new_map_for_grouping<K, I: Iterator, F: FnMut(&I::Item) ->K>(iter: I, key_mapper: F) -> MapForGrouping<I, F> {
31+
MapSpecialCase {
32+
iter,
33+
f: GroupingMapFn(key_mapper),
3634
}
3735
}
3836

src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3194,7 +3194,7 @@ pub trait Itertools: Iterator {
31943194
K: Hash + Eq,
31953195
F: FnMut(&V) -> K,
31963196
{
3197-
grouping_map::new(grouping_map::MapForGrouping::new(self, key_mapper))
3197+
grouping_map::new(grouping_map::new_map_for_grouping(self, key_mapper))
31983198
}
31993199

32003200
/// Return all minimum elements of an iterator.

0 commit comments

Comments
 (0)