Skip to content

Commit

Permalink
Auto merge of #92070 - rukai:replace_vec_into_iter_with_array_into_it…
Browse files Browse the repository at this point in the history
…er, r=Mark-Simulacrum

Replace usages of vec![].into_iter with [].into_iter

`[].into_iter` is idiomatic over `vec![].into_iter` because its simpler and faster (unless the vec is optimized away in which case it would be the same)

So we should change all the implementation, documentation and tests to use it.

I skipped:
* `src/tools` - Those are copied in from upstream
* `src/test/ui` - Hard to tell if `vec![].into_iter` was used intentionally or not here and not much benefit to changing it.
*  any case where `vec![].into_iter` was used because we specifically needed a `Vec::IntoIter<T>`
*  any case where it looked like we were intentionally using `vec![].into_iter` to test it.
  • Loading branch information
bors committed Jan 11, 2022
2 parents 76ce085 + ba264b3 commit 75b9a4a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ impl NodeLabels<&'static str> {
match self {
UnlabelledNodes(len) => vec![None; len],
AllNodesLabelled(lbls) => lbls.into_iter().map(Some).collect(),
SomeNodesLabelled(lbls) => lbls.into_iter().collect(),
SomeNodesLabelled(lbls) => lbls,
}
}

Expand Down

0 comments on commit 75b9a4a

Please sign in to comment.