From d7b3fa4e76223b9d409faa4d241a83d716c122f0 Mon Sep 17 00:00:00 2001 From: Giles Cope Date: Sun, 17 Jan 2021 16:02:28 +0000 Subject: [PATCH] Switched numbers to chars so that its clearer which part of the tuple result is the count. --- src/lib.rs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 284a25d6b..7cd451d1f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1110,12 +1110,13 @@ pub trait Itertools : Iterator { /// ``` /// use itertools::Itertools; /// - /// let data = vec![1., 1., 2., 3., 3., 2., 2.]; + /// let data = vec!['a', 'a', 'b', 'c', 'c', 'b', 'b']; /// itertools::assert_equal(data.into_iter().dedup_with_count(), - /// vec![(2, 1.), (1, 2.), (2, 3.), (2, 2.)]); + /// vec![(2, 'a'), (1, 'b'), (2, 'c'), (2, 'b')]); /// ``` fn dedup_with_count(self) -> DedupWithCount - where Self: Sized, + where + Self: Sized, { adaptors::dedup_with_count(self) } @@ -1132,13 +1133,14 @@ pub trait Itertools : Iterator { /// ``` /// use itertools::Itertools; /// - /// let data = vec![(0, 1.), (1, 1.), (0, 2.), (0, 3.), (1, 3.), (1, 2.), (2, 2.)]; + /// let data = vec![(0, 'a'), (1, 'a'), (0, 'b'), (0, 'c'), (1, 'c'), (1, 'b'), (2, 'b')]; /// itertools::assert_equal(data.into_iter().dedup_by_with_count(|x, y| x.1 == y.1), - /// vec![(2, (0, 1.)), (1, (0, 2.)), (2, (0, 3.)), (2, (1, 2.))]); + /// vec![(2, (0, 'a')), (1, (0, 'b')), (2, (0, 'c')), (2, (1, 'b'))]); /// ``` fn dedup_by_with_count(self, cmp: Cmp) -> DedupByWithCount - where Self: Sized, - Cmp: FnMut(&Self::Item, &Self::Item) -> bool, + where + Self: Sized, + Cmp: FnMut(&Self::Item, &Self::Item) -> bool, { adaptors::dedup_by_with_count(self, cmp) }