auto merge of #5212 : thestinger/rust/iter, r=graydon

A small step towards fixing #2827
This commit is contained in:
bors 2013-03-05 02:06:50 -08:00
commit eddefbc893
39 changed files with 120 additions and 118 deletions

View file

@ -537,7 +537,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)
}
}

View file

@ -294,7 +294,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,

View file

@ -732,7 +732,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);
@ -1271,10 +1271,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) => {
@ -1422,12 +1422,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");
@ -1667,7 +1667,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);

View file

@ -220,7 +220,7 @@ pub fn visit_enum_def<E>(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) }
}
}
@ -264,7 +264,7 @@ pub fn visit_pat<E>(p: @pat, e: E, v: vt<E>) {
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); }
}
}
@ -289,7 +289,7 @@ pub fn visit_pat<E>(p: @pat, e: E, v: vt<E>) {
},
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) => {
@ -301,7 +301,7 @@ pub fn visit_pat<E>(p: @pat, e: E, v: vt<E>) {
for elts.each |elt| {
(v.visit_pat)(*elt, e, v);
}
do tail.iter |tail| {
for tail.each |tail| {
(v.visit_pat)(*tail, e, v);
}
}
@ -415,7 +415,7 @@ pub fn visit_struct_def<E>(
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,
@ -423,7 +423,7 @@ pub fn visit_struct_def<E>(
e,
v
)
};
}
}
pub fn visit_struct_field<E>(sf: @struct_field, e: E, v: vt<E>) {