Skip to content

Commit

Permalink
GroupingMapBy: fix Debug implementation
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Philippe-Cholet authored and jswrenn committed Jan 23, 2024
1 parent 2e325a0 commit 94452e3
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/grouping_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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>(I, F);

impl<I: fmt::Debug, F> fmt::Debug for MapForGrouping<I, F> {
debug_fmt_fields!(MapForGrouping, 0);
}

impl<I, F> MapForGrouping<I, F> {
pub(crate) fn new(iter: I, key_mapper: F) -> Self {
Self(iter, key_mapper)
Expand Down

0 comments on commit 94452e3

Please sign in to comment.