std: Require &mut self for Iterator::all
Keeps the method consistent with `Iterator::any`. Closes #22617 [breaking-change]
This commit is contained in:
parent
ad04cce61c
commit
18878b155e
2 changed files with 3 additions and 3 deletions
|
|
@ -637,8 +637,8 @@ pub trait IteratorExt: Iterator + Sized {
|
|||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn all<F>(self, mut f: F) -> bool where F: FnMut(Self::Item) -> bool {
|
||||
for x in self { if !f(x) { return false; } }
|
||||
fn all<F>(&mut self, mut f: F) -> bool where F: FnMut(Self::Item) -> bool {
|
||||
for x in self.by_ref() { if !f(x) { return false; } }
|
||||
true
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3883,7 +3883,7 @@ pub fn is_type_representable<'tcx>(cx: &ctxt<'tcx>, sp: Span, ty: Ty<'tcx>)
|
|||
let types_a = substs_a.types.get_slice(subst::TypeSpace);
|
||||
let types_b = substs_b.types.get_slice(subst::TypeSpace);
|
||||
|
||||
let pairs = types_a.iter().zip(types_b.iter());
|
||||
let mut pairs = types_a.iter().zip(types_b.iter());
|
||||
|
||||
pairs.all(|(&a, &b)| same_type(a, b))
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue