Skip to content

Commit e4f4a6e

Browse files
Philippe-Choletphimuemue
authored andcommitted
Update group_by doc example
1 parent 0d741ab commit e4f4a6e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -593,15 +593,15 @@ pub trait Itertools: Iterator {
593593
/// ```
594594
/// use itertools::Itertools;
595595
///
596-
/// // group data into runs of larger than zero or not.
596+
/// // chunk data into runs of larger than zero or not.
597597
/// let data = vec![1, 3, -2, -2, 1, 0, 1, 2];
598-
/// // groups: |---->|------>|--------->|
598+
/// // chunks: |---->|------>|--------->|
599599
///
600600
/// // Note: The `&` is significant here, `GroupBy` is iterable
601601
/// // only by reference. You can also call `.into_iter()` explicitly.
602602
/// let mut data_grouped = Vec::new();
603-
/// for (key, group) in &data.into_iter().chunk_by(|elt| *elt >= 0) {
604-
/// data_grouped.push((key, group.collect()));
603+
/// for (key, chunk) in &data.into_iter().chunk_by(|elt| *elt >= 0) {
604+
/// data_grouped.push((key, chunk.collect()));
605605
/// }
606606
/// assert_eq!(data_grouped, vec![(true, vec![1, 3]), (false, vec![-2, -2]), (true, vec![1, 0, 1, 2])]);
607607
/// ```

0 commit comments

Comments
 (0)