about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2012-09-18 21:41:37 -0700
committerNiko Matsakis <niko@alum.mit.edu>2012-09-19 10:52:59 -0700
commit9cf271fe96b474d514b1052935db70c4056cf076 (patch)
tree7a6fb31efeaa4de91317c16aca824153aaaf988c /src/libsyntax
parent62b7f4d800325b46002c47d23b58a9f2b7fabb9b (diff)
downloadrust-9cf271fe96b474d514b1052935db70c4056cf076.tar.gz
rust-9cf271fe96b474d514b1052935db70c4056cf076.zip
De-mode vec::each() and many of the str iteration routines
Note that the method foo.each() is not de-moded, nor the other
vec routines.
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/ast_map.rs6
-rw-r--r--src/libsyntax/ast_util.rs68
-rw-r--r--src/libsyntax/ext/qquote.rs2
-rw-r--r--src/libsyntax/ext/simplext.rs2
-rw-r--r--src/libsyntax/print/pprust.rs2
-rw-r--r--src/libsyntax/visit.rs2
6 files changed, 43 insertions, 39 deletions
diff --git a/src/libsyntax/ast_map.rs b/src/libsyntax/ast_map.rs
index d9a7543eed4..c110af491fc 100644
--- a/src/libsyntax/ast_map.rs
+++ b/src/libsyntax/ast_map.rs
@@ -293,8 +293,10 @@ fn map_struct_def(struct_def: @ast::struct_def, parent_node: ast_node,
     }
     let d_id = ast_util::local_def(id);
     let p = extend(cx, ident);
-     // only need to handle methods
-    do vec::iter(struct_def.methods) |m| { map_method(d_id, p, m, cx); }
+    // only need to handle methods
+    for vec::each(struct_def.methods) |m| {
+        map_method(d_id, p, *m, cx);
+    }
 }
 
 fn map_view_item(vi: @view_item, cx: ctx, _v: vt) {
diff --git a/src/libsyntax/ast_util.rs b/src/libsyntax/ast_util.rs
index 6140014d848..e134f1cb805 100644
--- a/src/libsyntax/ast_util.rs
+++ b/src/libsyntax/ast_util.rs
@@ -429,13 +429,13 @@ fn id_visitor(vfn: fn@(node_id)) -> visit::vt<()> {
             match vi.node {
               view_item_use(_, _, id) => vfn(id),
               view_item_import(vps) | view_item_export(vps) => {
-                do vec::iter(vps) |vp| {
-                    match vp.node {
-                      view_path_simple(_, _, _, id) => vfn(id),
-                      view_path_glob(_, id) => vfn(id),
-                      view_path_list(_, _, id) => vfn(id)
-                    }
-                }
+                  for vec::each(vps) |vp| {
+                      match vp.node {
+                          view_path_simple(_, _, _, id) => vfn(id),
+                          view_path_glob(_, id) => vfn(id),
+                          view_path_list(_, _, id) => vfn(id)
+                      }
+                  }
               }
             }
         },
@@ -490,7 +490,9 @@ fn id_visitor(vfn: fn@(node_id)) -> visit::vt<()> {
         },
 
         visit_ty_params: fn@(ps: ~[ty_param]) {
-            vec::iter(ps, |p| vfn(p.id))
+            for vec::each(ps) |p| {
+                vfn(p.id);
+            }
         },
 
         visit_fn: fn@(fk: visit::fn_kind, d: ast::fn_decl,
@@ -498,34 +500,34 @@ fn id_visitor(vfn: fn@(node_id)) -> visit::vt<()> {
             vfn(id);
 
             match fk {
-              visit::fk_ctor(_, _, tps, self_id, parent_id) => {
-                vec::iter(tps, |tp| vfn(tp.id));
-                vfn(id);
-                vfn(self_id);
-                vfn(parent_id.node);
-              }
-              visit::fk_dtor(tps, _, self_id, parent_id) => {
-                vec::iter(tps, |tp| vfn(tp.id));
-                vfn(id);
-                vfn(self_id);
-                vfn(parent_id.node);
-              }
-              visit::fk_item_fn(_, tps, _) => {
-                vec::iter(tps, |tp| vfn(tp.id));
-              }
-              visit::fk_method(_, tps, m) => {
-                vfn(m.self_id);
-                vec::iter(tps, |tp| vfn(tp.id));
-              }
-              visit::fk_anon(_, capture_clause)
-              | visit::fk_fn_block(capture_clause) => {
-                for vec::each(*capture_clause) |clause| {
-                    vfn(clause.id);
+                visit::fk_ctor(_, _, tps, self_id, parent_id) => {
+                    for vec::each(tps) |tp| { vfn(tp.id); }
+                    vfn(id);
+                    vfn(self_id);
+                    vfn(parent_id.node);
+                }
+                visit::fk_dtor(tps, _, self_id, parent_id) => {
+                    for vec::each(tps) |tp| { vfn(tp.id); }
+                    vfn(id);
+                    vfn(self_id);
+                    vfn(parent_id.node);
+                }
+                visit::fk_item_fn(_, tps, _) => {
+                    for vec::each(tps) |tp| { vfn(tp.id); }
+                }
+                visit::fk_method(_, tps, m) => {
+                    vfn(m.self_id);
+                    for vec::each(tps) |tp| { vfn(tp.id); }
+                }
+                visit::fk_anon(_, capture_clause) |
+                visit::fk_fn_block(capture_clause) => {
+                    for vec::each(*capture_clause) |clause| {
+                        vfn(clause.id);
+                    }
                 }
-              }
             }
 
-            do vec::iter(d.inputs) |arg| {
+            for vec::each(d.inputs) |arg| {
                 vfn(arg.id)
             }
         },
diff --git a/src/libsyntax/ext/qquote.rs b/src/libsyntax/ext/qquote.rs
index d97124d5f44..da37e44b58c 100644
--- a/src/libsyntax/ext/qquote.rs
+++ b/src/libsyntax/ext/qquote.rs
@@ -228,7 +228,7 @@ fn finish<T: qq_helper>
     let mut state = active;
     let mut i = 0u, j = 0u;
     let g_len = cx.gather.len();
-    do str::chars_iter(*str) |ch| {
+    for str::chars_each(*str) |ch| {
         if (j < g_len && i == cx.gather[j].lo) {
             assert ch == '$';
             let repl = fmt!("$%u ", j);
diff --git a/src/libsyntax/ext/simplext.rs b/src/libsyntax/ext/simplext.rs
index 08fa427d078..2061be58488 100644
--- a/src/libsyntax/ext/simplext.rs
+++ b/src/libsyntax/ext/simplext.rs
@@ -211,7 +211,7 @@ pure fn follow(m: arb_depth<matchable>, idx_path: &[uint]) ->
     for vec::each(idx_path) |idx| {
         res = match res {
           leaf(_) => return res,/* end of the line */
-          seq(new_ms, _) => new_ms[idx]
+          seq(new_ms, _) => new_ms[*idx]
         }
     }
     return res;
diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs
index 4998dc7af6c..a87e3c4b52b 100644
--- a/src/libsyntax/print/pprust.rs
+++ b/src/libsyntax/print/pprust.rs
@@ -1674,7 +1674,7 @@ fn print_bounds(s: ps, bounds: @~[ast::ty_param_bound]) {
         word(s.s, ~":");
         for vec::each(*bounds) |bound| {
             nbsp(s);
-            match bound {
+            match *bound {
               ast::bound_copy => word(s.s, ~"Copy"),
               ast::bound_send => word(s.s, ~"Send"),
               ast::bound_const => word(s.s, ~"Const"),
diff --git a/src/libsyntax/visit.rs b/src/libsyntax/visit.rs
index ffe97197f6f..4c48a2bea70 100644
--- a/src/libsyntax/visit.rs
+++ b/src/libsyntax/visit.rs
@@ -263,7 +263,7 @@ fn visit_foreign_item<E>(ni: @foreign_item, e: E, v: vt<E>) {
 
 fn visit_ty_param_bounds<E>(bounds: @~[ty_param_bound], e: E, v: vt<E>) {
     for vec::each(*bounds) |bound| {
-        match bound {
+        match *bound {
           bound_trait(t) => v.visit_ty(t, e, v),
           bound_copy | bound_send | bound_const | bound_owned => ()
         }