Skip to content

Commit 366f67f

Browse files
committed
Tiny tweak to Iterator::unzip() doc comment example.
It's easier to figure out what it's doing and which output elements map to which input ones if the matrix we are dealing with is rectangular 2x3 rather than square 2x2.
1 parent d387441 commit 366f67f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

core/src/iter/traits/iterator.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2837,12 +2837,12 @@ pub trait Iterator {
28372837
/// Basic usage:
28382838
///
28392839
/// ```
2840-
/// let a = [(1, 2), (3, 4)];
2840+
/// let a = [(1, 2), (3, 4), (5, 6)];
28412841
///
28422842
/// let (left, right): (Vec<_>, Vec<_>) = a.iter().cloned().unzip();
28432843
///
2844-
/// assert_eq!(left, [1, 3]);
2845-
/// assert_eq!(right, [2, 4]);
2844+
/// assert_eq!(left, [1, 3, 5]);
2845+
/// assert_eq!(right, [2, 4, 6]);
28462846
///
28472847
/// // you can also unzip multiple nested tuples at once
28482848
/// let a = [(1, (2, 3)), (4, (5, 6))];

0 commit comments

Comments
 (0)