Skip to content

Commit

Permalink
Rollup merge of #90034 - moxian:unzip-doc, r=cuviper
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
matthiaskrgr committed Oct 19, 2021
2 parents a3a6b49 + 1519ca9 commit 5bcaf04
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions library/core/src/iter/traits/iterator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2837,12 +2837,12 @@ pub trait Iterator {
/// Basic usage:
///
/// ```
/// let a = [(1, 2), (3, 4)];
/// let a = [(1, 2), (3, 4), (5, 6)];
///
/// let (left, right): (Vec<_>, Vec<_>) = a.iter().cloned().unzip();
///
/// assert_eq!(left, [1, 3]);
/// assert_eq!(right, [2, 4]);
/// assert_eq!(left, [1, 3, 5]);
/// assert_eq!(right, [2, 4, 6]);
///
/// // you can also unzip multiple nested tuples at once
/// let a = [(1, (2, 3)), (4, (5, 6))];
Expand Down

0 comments on commit 5bcaf04

Please sign in to comment.