Removed many pointless calls to *iter() and iter_mut()

This commit is contained in:
Joshua Landau
2015-06-10 17:22:20 +01:00
parent d8a9570154
commit ca7418b846
117 changed files with 292 additions and 294 deletions

View File

@@ -177,7 +177,7 @@ pub trait Iterator {
/// ```
/// let a = [0];
/// let b = [1];
/// let mut it = a.iter().chain(b.iter());
/// let mut it = a.iter().chain(&b);
/// assert_eq!(it.next(), Some(&0));
/// assert_eq!(it.next(), Some(&1));
/// assert!(it.next().is_none());
@@ -200,7 +200,7 @@ pub trait Iterator {
/// ```
/// let a = [0];
/// let b = [1];
/// let mut it = a.iter().zip(b.iter());
/// let mut it = a.iter().zip(&b);
/// assert_eq!(it.next(), Some((&0, &1)));
/// assert!(it.next().is_none());
/// ```
@@ -585,9 +585,9 @@ pub trait Iterator {
for x in self {
if f(&x) {
left.extend(Some(x).into_iter())
left.extend(Some(x))
} else {
right.extend(Some(x).into_iter())
right.extend(Some(x))
}
}
@@ -994,8 +994,8 @@ pub trait Iterator {
us.extend(SizeHint(lo, hi, marker::PhantomData));
for (t, u) in self {
ts.extend(Some(t).into_iter());
us.extend(Some(u).into_iter());
ts.extend(Some(t));
us.extend(Some(u));
}
(ts, us)

View File

@@ -146,7 +146,7 @@ macro_rules! define_bignum {
let mut sz = cmp::max(self.size, other.size);
let mut carry = false;
for (a, b) in self.base[..sz].iter_mut().zip(other.base[..sz].iter()) {
for (a, b) in self.base[..sz].iter_mut().zip(&other.base[..sz]) {
let (c, v) = (*a).full_add(*b, carry);
*a = v;
carry = c;
@@ -166,7 +166,7 @@ macro_rules! define_bignum {
let sz = cmp::max(self.size, other.size);
let mut noborrow = true;
for (a, b) in self.base[..sz].iter_mut().zip(other.base[..sz].iter()) {
for (a, b) in self.base[..sz].iter_mut().zip(&other.base[..sz]) {
let (c, v) = (*a).full_add(!*b, noborrow);
*a = v;
noborrow = c;
@@ -183,7 +183,7 @@ macro_rules! define_bignum {
let mut sz = self.size;
let mut carry = 0;
for a in self.base[..sz].iter_mut() {
for a in &mut self.base[..sz] {
let (c, v) = (*a).full_mul(other, carry);
*a = v;
carry = c;

View File

@@ -124,7 +124,7 @@
//! // but to start with we've just got `None`.
//! let mut name_of_biggest_animal = None;
//! let mut size_of_biggest_animal = 0;
//! for big_thing in all_the_big_things.iter() {
//! for big_thing in &all_the_big_things {
//! match *big_thing {
//! Kingdom::Animal(size, name) if size > size_of_biggest_animal => {
//! // Now we've found the name of some big animal