From d0502b93efb6aa4caa7e044941937f45e41ae484 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Wed, 3 Aug 2016 19:32:51 -0700 Subject: [PATCH] Fix clippy lint about looping over iter() --- serde/src/ser/impls.rs | 4 ++-- serde_codegen/src/ser.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) 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"),