Skip to content

Commit 4d902e3

Browse files
bors[bot]gilescope
andauthored
Merge #516
516: Switched numbers to chars so that its clearer r=jswrenn a=gilescope I read the docs in the IDE and I thought the example could be clearer - there were lots of numbers. I think this makes it clearer to read as to how the result is structured. Co-authored-by: Giles Cope <[email protected]>
2 parents 2d52ca2 + d7b3fa4 commit 4d902e3

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/lib.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1110,12 +1110,13 @@ pub trait Itertools : Iterator {
11101110
/// ```
11111111
/// use itertools::Itertools;
11121112
///
1113-
/// let data = vec![1., 1., 2., 3., 3., 2., 2.];
1113+
/// let data = vec!['a', 'a', 'b', 'c', 'c', 'b', 'b'];
11141114
/// itertools::assert_equal(data.into_iter().dedup_with_count(),
1115-
/// vec![(2, 1.), (1, 2.), (2, 3.), (2, 2.)]);
1115+
/// vec![(2, 'a'), (1, 'b'), (2, 'c'), (2, 'b')]);
11161116
/// ```
11171117
fn dedup_with_count(self) -> DedupWithCount<Self>
1118-
where Self: Sized,
1118+
where
1119+
Self: Sized,
11191120
{
11201121
adaptors::dedup_with_count(self)
11211122
}
@@ -1132,13 +1133,14 @@ pub trait Itertools : Iterator {
11321133
/// ```
11331134
/// use itertools::Itertools;
11341135
///
1135-
/// let data = vec![(0, 1.), (1, 1.), (0, 2.), (0, 3.), (1, 3.), (1, 2.), (2, 2.)];
1136+
/// let data = vec![(0, 'a'), (1, 'a'), (0, 'b'), (0, 'c'), (1, 'c'), (1, 'b'), (2, 'b')];
11361137
/// itertools::assert_equal(data.into_iter().dedup_by_with_count(|x, y| x.1 == y.1),
1137-
/// vec![(2, (0, 1.)), (1, (0, 2.)), (2, (0, 3.)), (2, (1, 2.))]);
1138+
/// vec![(2, (0, 'a')), (1, (0, 'b')), (2, (0, 'c')), (2, (1, 'b'))]);
11381139
/// ```
11391140
fn dedup_by_with_count<Cmp>(self, cmp: Cmp) -> DedupByWithCount<Self, Cmp>
1140-
where Self: Sized,
1141-
Cmp: FnMut(&Self::Item, &Self::Item) -> bool,
1141+
where
1142+
Self: Sized,
1143+
Cmp: FnMut(&Self::Item, &Self::Item) -> bool,
11421144
{
11431145
adaptors::dedup_by_with_count(self, cmp)
11441146
}

0 commit comments

Comments
 (0)