Replace some once(x).chain(once(y)) with [x, y] IntoIter#77514
Merged
bors merged 1 commit intorust-lang:masterfrom Oct 5, 2020
Merged
Replace some once(x).chain(once(y)) with [x, y] IntoIter#77514bors merged 1 commit intorust-lang:masterfrom
bors merged 1 commit intorust-lang:masterfrom
Conversation
Now that we have by-value array iterators...
Contributor
|
r? @estebank (rust_highfive has picked a reviewer for you, use r? to override) |
Member
|
Is there an |
Contributor
|
@bors r+ |
Collaborator
|
📌 Commit d74b8e0 has been approved by |
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Oct 5, 2020
Rollup of 11 pull requests Successful merges: - rust-lang#75853 (Use more intra-doc-links in `core::fmt`) - rust-lang#75928 (Remove trait_selection error message in specific case) - rust-lang#76329 (Add check for doc alias attribute at crate level) - rust-lang#77219 (core::global_allocator docs link to std::alloc::GlobalAlloc) - rust-lang#77395 (BTreeMap: admit the existence of leaf edges in comments) - rust-lang#77407 (Improve build-manifest to work with the improved promote-release) - rust-lang#77426 (Include scope id in SocketAddrV6::Display) - rust-lang#77439 (Fix missing diagnostic span for `impl Trait` with const generics, and add various tests for `min_const_generics` and `const_generics`) - rust-lang#77471 (BTreeMap: refactoring around edges, missed spots) - rust-lang#77512 (Allow `Abort` terminators in all const-contexts) - rust-lang#77514 (Replace some once(x).chain(once(y)) with [x, y] IntoIter) Failed merges: r? `@ghost`
shepmaster
reviewed
Oct 5, 2020
| use std::iter::once; | ||
|
|
||
| once(self.type_ns).chain(once(self.value_ns)).chain(once(self.macro_ns)).filter_map(|it| it) | ||
| IntoIter::new([self.type_ns, self.value_ns, self.macro_ns]).filter_map(|it| it) |
Member
Author
There was a problem hiding this comment.
Frustratingly, flatten gives worse size_hints than filter_map today (#48544) and has more complicated code (needs to keep the iterator in its state after giving out an item, since unlike Option it doesn't know if that's the only item), so that's potentially a pessimization.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Now that we have by-value array iterators that are already used...
For example,