Rollup merge of #90034 - moxian:unzip-doc, r=cuviper

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.
This commit is contained in:
Matthias Krüger 2021-10-19 05:40:56 +02:00 committed by GitHub
commit 5bcaf04cbb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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))];