diff options
Diffstat (limited to 'src/librustc/lint/builtin.rs')
| -rw-r--r-- | src/librustc/lint/builtin.rs | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/librustc/lint/builtin.rs b/src/librustc/lint/builtin.rs index 904c9c3adb5..57380ec2797 100644 --- a/src/librustc/lint/builtin.rs +++ b/src/librustc/lint/builtin.rs @@ -459,7 +459,7 @@ impl LintPass for ImproperCTypes { } fn check_foreign_fn(cx: &Context, decl: &ast::FnDecl) { - for input in decl.inputs.iter() { + for input in &decl.inputs { check_ty(cx, &*input.ty); } if let ast::Return(ref ret_ty) = decl.output { @@ -469,7 +469,7 @@ impl LintPass for ImproperCTypes { match it.node { ast::ItemForeignMod(ref nmod) if nmod.abi != abi::RustIntrinsic => { - for ni in nmod.items.iter() { + for ni in &nmod.items { match ni.node { ast::ForeignItemFn(ref decl, _) => check_foreign_fn(cx, &**decl), ast::ForeignItemStatic(ref t, _) => check_ty(cx, &**t) @@ -532,7 +532,7 @@ impl LintPass for BoxPointers { // If it's a struct, we also have to check the fields' types match it.node { ast::ItemStruct(ref struct_def, _) => { - for struct_field in struct_def.fields.iter() { + for struct_field in &struct_def.fields { self.check_heap_type(cx, struct_field.span, ty::node_id_to_type(cx.tcx, struct_field.node.id)); } @@ -683,7 +683,7 @@ impl LintPass for UnusedAttributes { "no_builtins", ]; - for &name in ATTRIBUTE_WHITELIST.iter() { + for &name in ATTRIBUTE_WHITELIST { if attr.check_name(name) { break; } @@ -785,7 +785,7 @@ impl LintPass for UnusedResults { } fn check_must_use(cx: &Context, attrs: &[ast::Attribute], sp: Span) -> bool { - for attr in attrs.iter() { + for attr in attrs { if attr.check_name("must_use") { let mut msg = "unused result which must be used".to_string(); // check for #[must_use="..."] @@ -869,7 +869,7 @@ impl LintPass for NonCamelCaseTypes { ast::ItemEnum(ref enum_definition, _) => { if has_extern_repr { return } self.check_case(cx, "type", it.ident, it.span); - for variant in enum_definition.variants.iter() { + for variant in &enum_definition.variants { self.check_case(cx, "variant", variant.node.name, variant.span); } } @@ -878,7 +878,7 @@ impl LintPass for NonCamelCaseTypes { } fn check_generics(&mut self, cx: &Context, it: &ast::Generics) { - for gen in it.ty_params.iter() { + for gen in &*it.ty_params { self.check_case(cx, "type parameter", gen.ident, gen.span); } } @@ -1048,7 +1048,7 @@ impl LintPass for NonSnakeCase { fn check_struct_def(&mut self, cx: &Context, s: &ast::StructDef, _: ast::Ident, _: &ast::Generics, _: ast::NodeId) { - for sf in s.fields.iter() { + for sf in &s.fields { if let ast::StructField_ { kind: ast::NamedField(ident, _), .. } = sf.node { self.check_snake_case(cx, "structure field", ident, sf.span); } @@ -1346,7 +1346,7 @@ impl UnusedMut { // avoid false warnings in match arms with multiple patterns let mut mutables = FnvHashMap(); - for p in pats.iter() { + for p in pats { pat_util::pat_bindings(&cx.tcx.def_map, &**p, |mode, id, _, path1| { let ident = path1.node; if let ast::BindByValue(ast::MutMutable) = mode { @@ -1361,7 +1361,7 @@ impl UnusedMut { } let used_mutables = cx.tcx.used_mut_nodes.borrow(); - for (_, v) in mutables.iter() { + for (_, v) in &mutables { if !v.iter().any(|e| used_mutables.contains(e)) { cx.span_lint(UNUSED_MUT, cx.tcx.map.span(v[0]), "variable does not need to be mutable"); @@ -1377,7 +1377,7 @@ impl LintPass for UnusedMut { fn check_expr(&mut self, cx: &Context, e: &ast::Expr) { if let ast::ExprMatch(_, ref arms, _) = e.node { - for a in arms.iter() { + for a in arms { self.check_unused_mut_pat(cx, &a.pats[]) } } @@ -1394,7 +1394,7 @@ impl LintPass for UnusedMut { fn check_fn(&mut self, cx: &Context, _: visit::FnKind, decl: &ast::FnDecl, _: &ast::Block, _: Span, _: ast::NodeId) { - for a in decl.inputs.iter() { + for a in &decl.inputs { self.check_unused_mut_pat(cx, slice::ref_slice(&a.pat)); } } @@ -1871,7 +1871,7 @@ impl LintPass for UnconditionalRecursion { if cx.current_level(UNCONDITIONAL_RECURSION) != Level::Allow { let sess = cx.sess(); // offer some help to the programmer. - for call in self_call_spans.iter() { + for call in &self_call_spans { sess.span_note(*call, "recursive call site") } sess.span_help(sp, "a `loop` may express intention better if this is on purpose") |
