From af645e848713536ac3c0a0c52de7b4d96f96fbc6 Mon Sep 17 00:00:00 2001 From: Daniel Micay Date: Sun, 3 Mar 2013 07:33:39 -0500 Subject: replace option::iter with a BaseIter impl --- src/libsyntax/ast_util.rs | 2 +- src/libsyntax/diagnostic.rs | 2 +- src/libsyntax/print/pprust.rs | 12 ++++++------ src/libsyntax/visit.rs | 12 ++++++------ 4 files changed, 14 insertions(+), 14 deletions(-) (limited to 'src/libsyntax') diff --git a/src/libsyntax/ast_util.rs b/src/libsyntax/ast_util.rs index 96f4dadb3db..80b02b83c58 100644 --- a/src/libsyntax/ast_util.rs +++ b/src/libsyntax/ast_util.rs @@ -538,7 +538,7 @@ pub fn walk_pat(pat: @pat, it: fn(@pat)) { for elts.each |p| { walk_pat(*p, it) } - do tail.iter |tail| { + for tail.each |tail| { walk_pat(*tail, it) } } diff --git a/src/libsyntax/diagnostic.rs b/src/libsyntax/diagnostic.rs index ba4ec7fb6db..41931a790f5 100644 --- a/src/libsyntax/diagnostic.rs +++ b/src/libsyntax/diagnostic.rs @@ -295,7 +295,7 @@ fn highlight_lines(cm: @codemap::CodeMap, } fn print_macro_backtrace(cm: @codemap::CodeMap, sp: span) { - do option::iter(&sp.expn_info) |ei| { + for sp.expn_info.each |ei| { let ss = option::map_default(&ei.callee.span, @~"", |span| @cm.span_to_str(*span)); print_diagnostic(*ss, note, diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index f808a3be6bb..59c250397c9 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -736,7 +736,7 @@ pub fn print_struct(s: @ps, nbsp(s); bopen(s); hardbreak_if_not_bol(s); - do struct_def.dtor.iter |dtor| { + for struct_def.dtor.each |dtor| { hardbreak_if_not_bol(s); maybe_print_comment(s, dtor.span.lo); print_outer_attributes(s, dtor.node.attrs); @@ -1275,10 +1275,10 @@ pub fn print_expr(s: @ps, &&expr: @ast::expr) { ast::expr_loop(ref blk, opt_ident) => { head(s, ~"loop"); space(s.s); - opt_ident.iter(|ident| { + for opt_ident.each |ident| { print_ident(s, *ident); word_space(s, ~":"); - }); + } print_block(s, blk); } ast::expr_match(expr, ref arms) => { @@ -1426,12 +1426,12 @@ pub fn print_expr(s: @ps, &&expr: @ast::expr) { ast::expr_break(opt_ident) => { word(s.s, ~"break"); space(s.s); - opt_ident.iter(|ident| {print_ident(s, *ident); space(s.s)}); + for opt_ident.each |ident| { print_ident(s, *ident); space(s.s) } } ast::expr_again(opt_ident) => { word(s.s, ~"loop"); space(s.s); - opt_ident.iter(|ident| {print_ident(s, *ident); space(s.s)}); + for opt_ident.each |ident| { print_ident(s, *ident); space(s.s) } } ast::expr_ret(result) => { word(s.s, ~"return"); @@ -1671,7 +1671,7 @@ pub fn print_pat(s: @ps, &&pat: @ast::pat, refutable: bool) { ast::pat_vec(elts, tail) => { word(s.s, ~"["); commasep(s, inconsistent, elts, |s, p| print_pat(s, p, refutable)); - do option::iter(&tail) |tail| { + for tail.each |tail| { if vec::len(elts) != 0u { word_space(s, ~","); } word(s.s, ~".."); print_pat(s, *tail, refutable); diff --git a/src/libsyntax/visit.rs b/src/libsyntax/visit.rs index 262754624cb..a2f7392fe0c 100644 --- a/src/libsyntax/visit.rs +++ b/src/libsyntax/visit.rs @@ -223,7 +223,7 @@ pub fn visit_enum_def(enum_definition: ast::enum_def, } } // Visit the disr expr if it exists - vr.node.disr_expr.iter(|ex| (v.visit_expr)(*ex, e, v)); + for vr.node.disr_expr.each |ex| { (v.visit_expr)(*ex, e, v) } } } @@ -267,7 +267,7 @@ pub fn visit_pat(p: @pat, e: E, v: vt) { match p.node { pat_enum(path, ref children) => { visit_path(path, e, v); - do children.iter |children| { + for children.each |children| { for children.each |child| { (v.visit_pat)(*child, e, v); } } } @@ -292,7 +292,7 @@ pub fn visit_pat(p: @pat, e: E, v: vt) { }, pat_ident(_, path, ref inner) => { visit_path(path, e, v); - do inner.iter |subpat| { (v.visit_pat)(*subpat, e, v) } + for inner.each |subpat| { (v.visit_pat)(*subpat, e, v) } } pat_lit(ex) => (v.visit_expr)(ex, e, v), pat_range(e1, e2) => { @@ -304,7 +304,7 @@ pub fn visit_pat(p: @pat, e: E, v: vt) { for elts.each |elt| { (v.visit_pat)(*elt, e, v); } - do tail.iter |tail| { + for tail.each |tail| { (v.visit_pat)(*tail, e, v); } } @@ -418,7 +418,7 @@ pub fn visit_struct_def( for sd.fields.each |f| { (v.visit_struct_field)(*f, e, v); } - do sd.dtor.iter |dtor| { + for sd.dtor.each |dtor| { visit_struct_dtor_helper( *dtor, generics, @@ -426,7 +426,7 @@ pub fn visit_struct_def( e, v ) - }; + } } pub fn visit_struct_field(sf: @struct_field, e: E, v: vt) { -- cgit 1.4.1-3-g733a5