Skip to content

Commit 5c4804f

Browse files
committed
clippy: it is more idiomatic to loop over references to containers instead of using explicit iteration methods
1 parent c6c5afc commit 5c4804f

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

crates/backend/src/codegen.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,19 @@ fn to_ident_name(s: &str) -> Cow<str> {
3131
impl ToTokens for ast::Program {
3232
// Generate wrappers for all the items that we've found
3333
fn to_tokens(&self, tokens: &mut TokenStream) {
34-
for export in self.exports.iter() {
34+
for export in &self.exports {
3535
export.to_tokens(tokens);
3636
}
37-
for s in self.structs.iter() {
37+
for s in &self.structs {
3838
s.to_tokens(tokens);
3939
}
4040
let mut types = HashSet::new();
41-
for i in self.imports.iter() {
41+
for i in &self.imports {
4242
if let ast::ImportKind::Type(t) = &i.kind {
4343
types.insert(t.name.clone());
4444
}
4545
}
46-
for i in self.imports.iter() {
46+
for i in &self.imports {
4747
DescribeImport(&i.kind).to_tokens(tokens);
4848

4949
if let Some(ns) = &i.js_namespace {
@@ -56,13 +56,13 @@ impl ToTokens for ast::Program {
5656

5757
i.kind.to_tokens(tokens);
5858
}
59-
for e in self.enums.iter() {
59+
for e in &self.enums {
6060
e.to_tokens(tokens);
6161
}
62-
for a in self.type_aliases.iter() {
62+
for a in &self.type_aliases {
6363
a.to_tokens(tokens);
6464
}
65-
for c in self.consts.iter() {
65+
for c in &self.consts {
6666
c.to_tokens(tokens);
6767
}
6868

@@ -231,7 +231,7 @@ impl ToTokens for ast::Struct {
231231
}
232232
}).to_tokens(tokens);
233233

234-
for field in self.fields.iter() {
234+
for field in &self.fields {
235235
field.to_tokens(tokens);
236236
}
237237
}

0 commit comments

Comments
 (0)