diff --git a/serde/src/ser/impls.rs b/serde/src/ser/impls.rs index 374ea627..106b1b50 100644 --- a/serde/src/ser/impls.rs +++ b/serde/src/ser/impls.rs @@ -157,7 +157,7 @@ impl Serialize for [T] where S: Serializer, { let mut state = try!(serializer.serialize_seq(Some(self.len()))); - for e in self.iter() { + for e in self { try!(serializer.serialize_seq_elt(&mut state, e)); } serializer.serialize_seq_end(state) @@ -174,7 +174,7 @@ macro_rules! array_impls { where S: Serializer, { let mut state = try!(serializer.serialize_seq_fixed_size($len)); - for e in self.iter() { + for e in self { try!(serializer.serialize_seq_elt(&mut state, e)); } serializer.serialize_seq_end(state) diff --git a/serde_codegen/src/ser.rs b/serde_codegen/src/ser.rs index 9937c33b..17606b8e 100644 --- a/serde_codegen/src/ser.rs +++ b/serde_codegen/src/ser.rs @@ -382,7 +382,7 @@ fn serialize_variant( } Style::Struct => { let mut pat = builder.pat().struct_().id(type_ident).id(variant_ident).build(); - for field in variant.fields.iter() { + for field in &variant.fields { let name = match field.ident { Some(name) => name, None => cx.span_bug(field.span, "struct variant has unnamed fields"),