-
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
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.
/// ``` | ||
/// | ||
/// 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.
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.
Apparently the .clone()
is (now?) unnecessary.
Update examples to no longer avoid iterating arrays for rust-lang#84513
dce0f52
to
18a3599
Compare
@bors r+ rollup |
…llaumeGomez Rollup of 4 pull requests Successful merges: - rust-lang#136183 (Update iterator.rs to use arrays by value) - rust-lang#139966 (coverage: Only merge adjacent coverage spans) - rust-lang#140692 (Rename `graph::implementation::Graph` to `LinkedGraph`) - rust-lang#140703 (Handle PR not found in post-merge workflow) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#136183 - hkBst:patch-25, r=Amanieu Update iterator.rs to use arrays by value Update examples to no longer avoid iterating arrays for rust-lang#84513
Update examples to no longer avoid iterating arrays for #84513