Auto merge of #28731 - bluss:by-ref, r=alexcrichton

Remove redundant uses of Iterator::by_ref()
This commit is contained in:
bors 2015-09-30 11:03:13 +00:00
commit 3e6d7243ae
4 changed files with 8 additions and 8 deletions

View File

@ -276,7 +276,7 @@ impl<T> DoubleEndedIterator for RawItems<T> {
impl<T> Drop for RawItems<T> {
fn drop(&mut self) {
for _ in self.by_ref() {}
for _ in self {}
}
}

View File

@ -1503,7 +1503,7 @@ impl<T> ExactSizeIterator for IntoIter<T> {}
impl<T> Drop for IntoIter<T> {
fn drop(&mut self) {
// destroy the remaining elements
for _x in self.by_ref() {}
for _x in self {}
// RawVec handles deallocation
}

View File

@ -165,7 +165,7 @@ pub trait Iterator {
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
fn nth(&mut self, mut n: usize) -> Option<Self::Item> where Self: Sized {
for x in self.by_ref() {
for x in self {
if n == 0 { return Some(x) }
n -= 1;
}
@ -637,7 +637,7 @@ pub trait Iterator {
fn all<F>(&mut self, mut f: F) -> bool where
Self: Sized, F: FnMut(Self::Item) -> bool
{
for x in self.by_ref() {
for x in self {
if !f(x) {
return false;
}
@ -664,7 +664,7 @@ pub trait Iterator {
Self: Sized,
F: FnMut(Self::Item) -> bool
{
for x in self.by_ref() {
for x in self {
if f(x) {
return true;
}
@ -689,7 +689,7 @@ pub trait Iterator {
Self: Sized,
P: FnMut(&Self::Item) -> bool,
{
for x in self.by_ref() {
for x in self {
if predicate(&x) { return Some(x) }
}
None
@ -725,7 +725,7 @@ pub trait Iterator {
P: FnMut(Self::Item) -> bool,
{
// `enumerate` might overflow.
for (i, x) in self.by_ref().enumerate() {
for (i, x) in self.enumerate() {
if predicate(x) {
return Some(i);
}

View File

@ -958,7 +958,7 @@ impl<'a, K, V> ExactSizeIterator for Drain<'a, K, V> {
impl<'a, K: 'a, V: 'a> Drop for Drain<'a, K, V> {
fn drop(&mut self) {
for _ in self.by_ref() {}
for _ in self {}
}
}