for x in xs.iter() -> for x in &xs
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user