From 94452e3eafb7c95fcbbb85c3dd78c274c6e43b62 Mon Sep 17 00:00:00 2001 From: Philippe-Cholet <44676486+Philippe-Cholet@users.noreply.github.com> Date: Tue, 23 Jan 2024 11:32:50 +0100 Subject: [PATCH] `GroupingMapBy`: fix Debug implementation Derive it is not the best in this case since `F` is a function. `MapForGrouping` is now Debug and `GroupingMapBy` too as it wraps it. --- src/grouping_map.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/grouping_map.rs b/src/grouping_map.rs index aeb86f1b2..a01968d4a 100644 --- a/src/grouping_map.rs +++ b/src/grouping_map.rs @@ -3,14 +3,19 @@ use crate::MinMaxResult; use std::cmp::Ordering; use std::collections::HashMap; +use std::fmt; use std::hash::Hash; use std::iter::Iterator; use std::ops::{Add, Mul}; /// A wrapper to allow for an easy [`into_grouping_map_by`](crate::Itertools::into_grouping_map_by) -#[derive(Clone, Debug)] +#[derive(Clone)] pub struct MapForGrouping(I, F); +impl fmt::Debug for MapForGrouping { + debug_fmt_fields!(MapForGrouping, 0); +} + impl MapForGrouping { pub(crate) fn new(iter: I, key_mapper: F) -> Self { Self(iter, key_mapper)