From 943a33686aa11b6d2c218e53614f28b4102ee4f2 Mon Sep 17 00:00:00 2001 From: philipp Date: Mon, 12 Feb 2024 22:52:10 +0100 Subject: [PATCH] fn new_map_for_grouping as free function --- src/grouping_map.rs | 10 ++++------ src/lib.rs | 2 +- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/grouping_map.rs b/src/grouping_map.rs index 33ae065d2..0dea42499 100644 --- a/src/grouping_map.rs +++ b/src/grouping_map.rs @@ -27,12 +27,10 @@ impl K> MapSpecialCaseFn for GroupingMapFn { } } -impl K> MapForGrouping { - pub(crate) fn new(iter: I, key_mapper: F) -> Self { - MapSpecialCase { - iter, - f: GroupingMapFn(key_mapper), - } +pub(crate) fn new_map_for_groupingK>(iter: I, key_mapper: F) -> MapForGrouping { + MapSpecialCase { + iter, + f: GroupingMapFn(key_mapper), } } diff --git a/src/lib.rs b/src/lib.rs index 218b3a8b9..b7973248d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -3194,7 +3194,7 @@ pub trait Itertools: Iterator { K: Hash + Eq, F: FnMut(&V) -> K, { - grouping_map::new(grouping_map::MapForGrouping::new(self, key_mapper)) + grouping_map::new(grouping_map::new_map_for_grouping(self, key_mapper)) } /// Return all minimum elements of an iterator.