about summary refs log tree commit diff
path: root/src/libserialize
diff options
context:
space:
mode:
authorJorge Aparicio <japaricious@gmail.com>2015-01-31 12:20:46 -0500
committerJorge Aparicio <japaricious@gmail.com>2015-02-02 13:40:18 -0500
commitd5d7e6565a4034b93d19be1edafd20730a4276bc (patch)
treef978751c20a214c9fe0cd2d60645a4e1a3b760fd /src/libserialize
parent9f90d666e0cd9a73ef35b76b6605f9d1f69df849 (diff)
downloadrust-d5d7e6565a4034b93d19be1edafd20730a4276bc.tar.gz
rust-d5d7e6565a4034b93d19be1edafd20730a4276bc.zip
`for x in xs.iter()` -> `for x in &xs`
Diffstat (limited to 'src/libserialize')
-rw-r--r--src/libserialize/collection_impls.rs10
-rw-r--r--src/libserialize/hex.rs2
-rw-r--r--src/libserialize/json.rs14
3 files changed, 13 insertions, 13 deletions
diff --git a/src/libserialize/collection_impls.rs b/src/libserialize/collection_impls.rs
index 8b39d91ffae..d61d5b68462 100644
--- a/src/libserialize/collection_impls.rs
+++ b/src/libserialize/collection_impls.rs
@@ -74,7 +74,7 @@ impl<
     fn encode<S: Encoder>(&self, e: &mut S) -> Result<(), S::Error> {
         e.emit_map(self.len(), |e| {
             let mut i = 0;
-            for (key, val) in self.iter() {
+            for (key, val) in self {
                 try!(e.emit_map_elt_key(i, |e| key.encode(e)));
                 try!(e.emit_map_elt_val(i, |e| val.encode(e)));
                 i += 1;
@@ -107,7 +107,7 @@ impl<
     fn encode<S: Encoder>(&self, s: &mut S) -> Result<(), S::Error> {
         s.emit_seq(self.len(), |s| {
             let mut i = 0;
-            for e in self.iter() {
+            for e in self {
                 try!(s.emit_seq_elt(i, |s| e.encode(s)));
                 i += 1;
             }
@@ -135,7 +135,7 @@ impl<
 > Encodable for EnumSet<T> {
     fn encode<S: Encoder>(&self, s: &mut S) -> Result<(), S::Error> {
         let mut bits = 0;
-        for item in self.iter() {
+        for item in self {
             bits |= item.to_uint();
         }
         s.emit_uint(bits)
@@ -166,7 +166,7 @@ impl<K, V, S> Encodable for HashMap<K, V, S>
     fn encode<E: Encoder>(&self, e: &mut E) -> Result<(), E::Error> {
         e.emit_map(self.len(), |e| {
             let mut i = 0;
-            for (key, val) in self.iter() {
+            for (key, val) in self {
                 try!(e.emit_map_elt_key(i, |e| key.encode(e)));
                 try!(e.emit_map_elt_val(i, |e| val.encode(e)));
                 i += 1;
@@ -204,7 +204,7 @@ impl<T, S> Encodable for HashSet<T, S>
     fn encode<E: Encoder>(&self, s: &mut E) -> Result<(), E::Error> {
         s.emit_seq(self.len(), |s| {
             let mut i = 0;
-            for e in self.iter() {
+            for e in self {
                 try!(s.emit_seq_elt(i, |s| e.encode(s)));
                 i += 1;
             }
diff --git a/src/libserialize/hex.rs b/src/libserialize/hex.rs
index c9b6af26ce0..a34ae1087db 100644
--- a/src/libserialize/hex.rs
+++ b/src/libserialize/hex.rs
@@ -42,7 +42,7 @@ impl ToHex for [u8] {
     /// ```
     fn to_hex(&self) -> String {
         let mut v = Vec::with_capacity(self.len() * 2);
-        for &byte in self.iter() {
+        for &byte in self {
             v.push(CHARS[(byte >> 4) as uint]);
             v.push(CHARS[(byte & 0xf) as uint]);
         }
diff --git a/src/libserialize/json.rs b/src/libserialize/json.rs
index 8d8bd32ba77..f43f22ec57c 100644
--- a/src/libserialize/json.rs
+++ b/src/libserialize/json.rs
@@ -1051,7 +1051,7 @@ impl Json {
     /// Otherwise, it will return the Json value associated with the final key.
     pub fn find_path<'a>(&'a self, keys: &[&str]) -> Option<&'a Json>{
         let mut target = self;
-        for key in keys.iter() {
+        for key in keys {
             match target.find(*key) {
                 Some(t) => { target = t; },
                 None => return None
@@ -1069,7 +1069,7 @@ impl Json {
                 match map.get(key) {
                     Some(json_value) => Some(json_value),
                     None => {
-                        for (_, v) in map.iter() {
+                        for (_, v) in map {
                             match v.search(key) {
                                 x if x.is_some() => return x,
                                 _ => ()
@@ -1367,7 +1367,7 @@ impl Stack {
     // Used by Parser to insert StackElement::Key elements at the top of the stack.
     fn push_key(&mut self, key: string::String) {
         self.stack.push(InternalKey(self.str_buffer.len() as u16, key.len() as u16));
-        for c in key.as_bytes().iter() {
+        for c in key.as_bytes() {
             self.str_buffer.push(*c);
         }
     }
@@ -2497,7 +2497,7 @@ impl<A: ToJson> ToJson for Vec<A> {
 impl<A: ToJson> ToJson for BTreeMap<string::String, A> {
     fn to_json(&self) -> Json {
         let mut d = BTreeMap::new();
-        for (key, value) in self.iter() {
+        for (key, value) in self {
             d.insert((*key).clone(), value.to_json());
         }
         Json::Object(d)
@@ -2507,7 +2507,7 @@ impl<A: ToJson> ToJson for BTreeMap<string::String, A> {
 impl<A: ToJson> ToJson for HashMap<string::String, A> {
     fn to_json(&self) -> Json {
         let mut d = BTreeMap::new();
-        for (key, value) in self.iter() {
+        for (key, value) in self {
             d.insert((*key).clone(), value.to_json());
         }
         Json::Object(d)
@@ -2670,7 +2670,7 @@ mod tests {
     fn mk_object(items: &[(string::String, Json)]) -> Json {
         let mut d = BTreeMap::new();
 
-        for item in items.iter() {
+        for item in items {
             match *item {
                 (ref key, ref value) => { d.insert((*key).clone(), (*value).clone()); },
             }
@@ -3044,7 +3044,7 @@ mod tests {
                  ("\"\\u12ab\"", "\u{12ab}"),
                  ("\"\\uAB12\"", "\u{AB12}")];
 
-        for &(i, o) in s.iter() {
+        for &(i, o) in &s {
             let v: string::String = super::decode(i).unwrap();
             assert_eq!(v, o);
         }