Rollup merge of #77514 - scottmcm:less-once-chain-once, r=estebank
Replace some once(x).chain(once(y)) with [x, y] IntoIter
Now that we have by-value array iterators that are [already used](25c8c53dd9/compiler/rustc_hir/src/def.rs (L305-L307)
)...
For example,
```diff
- 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)
```
This commit is contained in:
commit
9dbc9ed870
7 changed files with 11 additions and 9 deletions
|
@ -11,6 +11,7 @@
|
|||
//! This API is completely unstable and subject to change.
|
||||
|
||||
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
|
||||
#![feature(array_value_iter)]
|
||||
#![feature(bool_to_option)]
|
||||
#![feature(box_patterns)]
|
||||
#![feature(drain_filter)]
|
||||
|
|
|
@ -24,6 +24,7 @@ use rustc_span::symbol::Symbol;
|
|||
use rustc_span::Span;
|
||||
use smallvec::SmallVec;
|
||||
|
||||
use std::array;
|
||||
use std::iter;
|
||||
|
||||
pub use crate::traits::{MethodViolationCode, ObjectSafetyViolation};
|
||||
|
@ -652,8 +653,7 @@ fn receiver_is_dispatchable<'tcx>(
|
|||
let caller_bounds: Vec<Predicate<'tcx>> = param_env
|
||||
.caller_bounds()
|
||||
.iter()
|
||||
.chain(iter::once(unsize_predicate))
|
||||
.chain(iter::once(trait_predicate))
|
||||
.chain(array::IntoIter::new([unsize_predicate, trait_predicate]))
|
||||
.collect();
|
||||
|
||||
ty::ParamEnv::new(tcx.intern_predicates(&caller_bounds), param_env.reveal())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue