Skip to content

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

Merged
merged 1 commit into from
May 6, 2025
Merged

Conversation

hkBst
Copy link
Member

@hkBst hkBst commented Jan 28, 2025

Update examples to no longer avoid iterating arrays for #84513

@rustbot
Copy link
Collaborator

rustbot commented Jan 28, 2025

r? @Amanieu

rustbot has assigned @Amanieu.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Jan 28, 2025
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

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();
Copy link
Member

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.

Copy link
Member Author

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.

Copy link
Member Author

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
@hkBst hkBst requested a review from Amanieu May 6, 2025 13:26
@Amanieu
Copy link
Member

Amanieu commented May 6, 2025

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented May 6, 2025

📌 Commit 18a3599 has been approved by Amanieu

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 6, 2025
bors added a commit to rust-lang-ci/rust that referenced this pull request May 6, 2025
…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
@bors bors merged commit 8929f8a into rust-lang:master May 6, 2025
6 checks passed
@rustbot rustbot added this to the 1.88.0 milestone May 6, 2025
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request May 6, 2025
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants