std: Require &mut self for Iterator::all

Keeps the method consistent with `Iterator::any`.

Closes #22617
[breaking-change]
This commit is contained in:
Alex Crichton 2015-02-24 21:52:27 -08:00
parent ad04cce61c
commit 18878b155e
2 changed files with 3 additions and 3 deletions

View file

@ -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
}

View file

@ -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))
}