diff --git a/benches/bench_struct.rs b/benches/bench_struct.rs index c9b75a81..edc71000 100644 --- a/benches/bench_struct.rs +++ b/benches/bench_struct.rs @@ -283,7 +283,7 @@ mod decoder { match self.stack.pop() { Some(MapState(map)) => { let len = map.len(); - for (key, value) in map.into_iter() { + for (key, value) in map { match value { Some(c) => { self.stack.push(CharState(c)); @@ -404,7 +404,7 @@ mod deserializer { Some(MapState(value)) => { self.stack.push(EndState); let len = value.len(); - for (key, value) in value.into_iter() { + for (key, value) in value { match value { Some(c) => { self.stack.push(CharState(c)); diff --git a/serde2/src/json/de.rs b/serde2/src/json/de.rs index 9b59d90a..73d797bd 100644 --- a/serde2/src/json/de.rs +++ b/serde2/src/json/de.rs @@ -547,7 +547,7 @@ mod tests { fn test_parse_ok<'a, T>(errors: Vec<(&'a str, T)>) where T: PartialEq + Debug + Deserialize, { - for (s, value) in errors.into_iter() { + for (s, value) in errors { let v: Result = from_str(s); assert_eq!(v, Ok(value)); @@ -561,7 +561,7 @@ mod tests { fn test_parse_err<'a, T>(errors: Vec<(&'a str, Error)>) where T: PartialEq + Debug + Deserialize { - for (s, err) in errors.into_iter() { + for (s, err) in errors { let v: Result = from_str(s); assert_eq!(v, Err(err)); } diff --git a/src/json/mod.rs b/src/json/mod.rs index 629dcff5..17d749bf 100644 --- a/src/json/mod.rs +++ b/src/json/mod.rs @@ -427,7 +427,7 @@ mod tests { fn test_encode_ok< T: PartialEq + Debug + ToJson + ser::Serialize>, old_io::IoError> >(errors: &[(T, &str)]) { - for &(ref value, out) in errors.iter() { + for &(ref value, out) in errors { let out = out.to_string(); let s = super::to_string(value).unwrap(); @@ -441,7 +441,7 @@ mod tests { fn test_pretty_encode_ok< T: PartialEq + Debug + ToJson + ser::Serialize>, old_io::IoError> >(errors: &[(T, &str)]) { - for &(ref value, out) in errors.iter() { + for &(ref value, out) in errors { let out = out.to_string(); let s = super::to_pretty_string(value).unwrap(); @@ -778,7 +778,7 @@ mod tests { 'a, T: Debug + de::Deserialize>, Error> >(errors: &[(&'a str, Error)]) { - for &(s, ref err) in errors.iter() { + for &(s, ref err) in errors { let v: Result = from_str(s); assert_eq!(v.unwrap_err(), *err); } @@ -788,7 +788,7 @@ mod tests { 'a, T: PartialEq + Debug + ToJson + de::Deserialize>, Error> >(errors: &[(&'a str, T)]) { - for &(s, ref value) in errors.iter() { + for &(s, ref value) in errors { let v: T = from_str(s).unwrap(); assert_eq!(v, *value); @@ -800,7 +800,7 @@ mod tests { fn test_json_deserialize_ok< T: PartialEq + Debug + ToJson + de::Deserialize >(errors: &[T]) { - for value in errors.iter() { + for value in errors { let v: T = from_json(value.to_json()).unwrap(); assert_eq!(v, *value); diff --git a/src/json/value.rs b/src/json/value.rs index 01052a39..9fee4671 100644 --- a/src/json/value.rs +++ b/src/json/value.rs @@ -60,7 +60,7 @@ impl Value { /// Otherwise, it will return the Json value associated with the final key. pub fn find_path<'a>(&'a self, keys: &[&String]) -> Option<&'a Value>{ let mut target = self; - for key in keys.iter() { + for key in keys { match target.find(*key) { Some(t) => { target = t; }, None => return None @@ -79,7 +79,7 @@ impl Value { Some(json_value) => Some(json_value), None => { let mut value : Option<&'a Value> = None; - for (_, v) in map.iter() { + for (_, v) in map { value = v.search(key); if value.is_some() { break; @@ -643,7 +643,7 @@ impl ToJson for Vec { impl ToJson for BTreeMap { fn to_json(&self) -> Value { let mut d = BTreeMap::new(); - for (key, value) in self.iter() { + for (key, value) in self { d.insert((*key).clone(), value.to_json()); } Value::Object(d) @@ -653,7 +653,7 @@ impl ToJson for BTreeMap { impl ToJson for HashMap { fn to_json(&self) -> Value { let mut d = BTreeMap::new(); - for (key, value) in self.iter() { + for (key, value) in self { d.insert((*key).clone(), value.to_json()); } Value::Object(d)