Fix clippy lint about looping over iter()

This commit is contained in:
David Tolnay 2016-08-03 19:32:51 -07:00
parent b289edd4a4
commit d0502b93ef
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82
2 changed files with 3 additions and 3 deletions

View File

@ -157,7 +157,7 @@ impl<T> 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)

View File

@ -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"),