mirror of
https://github.com/servo/servo.git
synced 2025-07-28 17:50:37 +01:00
Replace uses of for foo in bar.iter()
and for foo in bar.iter_mut()
closes #7197
This commit is contained in:
parent
13e7de482c
commit
0038580abf
55 changed files with 141 additions and 154 deletions
|
@ -69,7 +69,7 @@ impl LintPass for InheritancePass {
|
|||
if cx.current_level(INHERITANCE_INTEGRITY) != Level::Allow {
|
||||
let sess = cx.sess();
|
||||
sess.span_note(sp, "Reflector found here");
|
||||
for span in dom_spans.iter() {
|
||||
for span in &dom_spans {
|
||||
sess.span_note(*span, "Bare DOM struct found here");
|
||||
}
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ impl LintPass for InheritancePass {
|
|||
cx.span_lint(INHERITANCE_INTEGRITY, cx.tcx.map.expect_item(id).span,
|
||||
"This DOM struct has multiple DOM struct members, only one is allowed");
|
||||
if cx.current_level(INHERITANCE_INTEGRITY) != Level::Allow {
|
||||
for span in dom_spans.iter() {
|
||||
for span in &dom_spans {
|
||||
cx.sess().span_note(*span, "Bare DOM struct found here");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ impl LintPass for PrivatizePass {
|
|||
_gen: &ast::Generics,
|
||||
id: ast::NodeId) {
|
||||
if cx.tcx.has_attr(ast_util::local_def(id), "privatize") {
|
||||
for field in def.fields.iter() {
|
||||
for field in &def.fields {
|
||||
match field.node {
|
||||
ast::StructField_ { kind: ast::NamedField(ident, visibility), .. } if visibility == Public => {
|
||||
cx.span_lint(PRIVATIZE, field.span,
|
||||
|
|
|
@ -88,7 +88,7 @@ impl LintPass for UnrootedPass {
|
|||
_ => cx.tcx.map.expect_item(cx.tcx.map.get_parent(id)),
|
||||
};
|
||||
if item.attrs.iter().all(|a| !a.check_name("must_root")) {
|
||||
for ref field in def.fields.iter() {
|
||||
for ref field in &def.fields {
|
||||
if is_unrooted_ty(cx, cx.tcx.node_id_to_type(field.node.id), false) {
|
||||
cx.span_lint(UNROOTED_MUST_ROOT, field.span,
|
||||
"Type must be rooted, use #[must_root] on the struct definition to propagate")
|
||||
|
@ -102,7 +102,7 @@ impl LintPass for UnrootedPass {
|
|||
if map.expect_item(map.get_parent(var.node.id)).attrs.iter().all(|a| !a.check_name("must_root")) {
|
||||
match var.node.kind {
|
||||
ast::TupleVariantKind(ref vec) => {
|
||||
for ty in vec.iter() {
|
||||
for ty in vec {
|
||||
ast_ty_to_prim_ty(cx.tcx, &*ty.ty).map(|t| {
|
||||
if is_unrooted_ty(cx, t, false) {
|
||||
cx.span_lint(UNROOTED_MUST_ROOT, ty.ty.span,
|
||||
|
@ -141,7 +141,7 @@ impl LintPass for UnrootedPass {
|
|||
|
||||
match block.rules {
|
||||
ast::DefaultBlock => {
|
||||
for arg in decl.inputs.iter() {
|
||||
for arg in &decl.inputs {
|
||||
ast_ty_to_prim_ty(cx.tcx, &*arg.ty).map(|t| {
|
||||
if is_unrooted_ty(cx, t, false) {
|
||||
cx.span_lint(UNROOTED_MUST_ROOT, arg.ty.span, "Type must be rooted")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue