for x in xs.iter() -> for x in &xs

This commit is contained in:
Jorge Aparicio
2015-01-31 12:20:46 -05:00
parent 9f90d666e0
commit d5d7e6565a
269 changed files with 1063 additions and 1064 deletions

View File

@@ -66,11 +66,11 @@ fn test_partial_min() {
(1.0f64, NAN, None)
];
for &(a, b, result) in data_integer.iter() {
for &(a, b, result) in &data_integer {
assert!(partial_min(a, b) == result);
}
for &(a, b, result) in data_float.iter() {
for &(a, b, result) in &data_float {
assert!(partial_min(a, b) == result);
}
}
@@ -99,11 +99,11 @@ fn test_partial_max() {
(1.0f64, NAN, None)
];
for &(a, b, result) in data_integer.iter() {
for &(a, b, result) in &data_integer {
assert!(partial_max(a, b) == result);
}
for &(a, b, result) in data_float.iter() {
for &(a, b, result) in &data_float {
assert!(partial_max(a, b) == result);
}
}

View File

@@ -25,7 +25,7 @@ impl Default for MyHasher {
impl Writer for MyHasher {
// Most things we'll just add up the bytes.
fn write(&mut self, buf: &[u8]) {
for byte in buf.iter() {
for byte in buf {
self.hash += *byte as u64;
}
}

View File

@@ -109,7 +109,7 @@ fn test_siphash() {
fn to_hex_str(r: &[u8; 8]) -> String {
let mut s = String::new();
for b in r.iter() {
for b in r {
s.push_str(format!("{}", fmt::radix(*b, 16)).as_slice());
}
s
@@ -130,7 +130,7 @@ fn test_siphash() {
fn result_str(h: u64) -> String {
let r = result_bytes(h);
let mut s = String::new();
for b in r.iter() {
for b in &r {
s.push_str(format!("{}", fmt::radix(*b, 16)).as_slice());
}
s