-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Update iterator.rs to use arrays by value #136183
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Update examples to no longer avoid iterating arrays for rust-lang#84513
/// ``` | ||
/// | ||
/// Flattening only removes one level of nesting at a time: | ||
/// | ||
/// ``` | ||
/// let d3 = [[[1, 2], [3, 4]], [[5, 6], [7, 8]]]; | ||
/// | ||
/// let d2 = d3.iter().flatten().collect::<Vec<_>>(); | ||
/// assert_eq!(d2, [&[1, 2], &[3, 4], &[5, 6], &[7, 8]]); | ||
/// let d2: Vec<_> = d3.clone().into_iter().flatten().collect(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is reasonable here: we don't want to encourage .clone().into_iter()
when .iter()
is sufficient.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, that is a good point. I'll have a look.
Update examples to no longer avoid iterating arrays for #84513