about summary refs log tree commit diff
path: root/src/libsyntax/ext
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2015-02-02 11:01:12 -0800
committerAlex Crichton <alex@alexcrichton.com>2015-02-02 11:01:12 -0800
commit7335c7dd63cafe70ffca76677f9e33bc6eccefaa (patch)
tree3646a5159f74b47d8bdf471eff072ea71f395d82 /src/libsyntax/ext
parent075588a4939acb47feea79779a9bdacce702d9c5 (diff)
parent3484706c38272828efc50b2553578afc62230dbb (diff)
downloadrust-7335c7dd63cafe70ffca76677f9e33bc6eccefaa.tar.gz
rust-7335c7dd63cafe70ffca76677f9e33bc6eccefaa.zip
rollup merge of #21830: japaric/for-cleanup
Conflicts:
	src/librustc/metadata/filesearch.rs
	src/librustc_back/target/mod.rs
	src/libstd/os.rs
	src/libstd/sys/windows/os.rs
	src/libsyntax/ext/tt/macro_parser.rs
	src/libsyntax/print/pprust.rs
	src/test/compile-fail/issue-2149.rs
Diffstat (limited to 'src/libsyntax/ext')
-rw-r--r--src/libsyntax/ext/concat.rs2
-rw-r--r--src/libsyntax/ext/deriving/generic/mod.rs4
-rw-r--r--src/libsyntax/ext/deriving/hash.rs2
-rw-r--r--src/libsyntax/ext/deriving/primitive.rs2
-rw-r--r--src/libsyntax/ext/expand.rs16
-rw-r--r--src/libsyntax/ext/format.rs4
-rw-r--r--src/libsyntax/ext/quote.rs2
-rw-r--r--src/libsyntax/ext/tt/macro_parser.rs8
-rw-r--r--src/libsyntax/ext/tt/macro_rules.rs2
9 files changed, 21 insertions, 21 deletions
diff --git a/src/libsyntax/ext/concat.rs b/src/libsyntax/ext/concat.rs
index 39895a3946a..4e10cc9aacc 100644
--- a/src/libsyntax/ext/concat.rs
+++ b/src/libsyntax/ext/concat.rs
@@ -25,7 +25,7 @@ pub fn expand_syntax_ext(cx: &mut base::ExtCtxt,
         None => return base::DummyResult::expr(sp)
     };
     let mut accumulator = String::new();
-    for e in es.into_iter() {
+    for e in es {
         match e.node {
             ast::ExprLit(ref lit) => {
                 match lit.node {
diff --git a/src/libsyntax/ext/deriving/generic/mod.rs b/src/libsyntax/ext/deriving/generic/mod.rs
index dc88ce6d190..02982039be0 100644
--- a/src/libsyntax/ext/deriving/generic/mod.rs
+++ b/src/libsyntax/ext/deriving/generic/mod.rs
@@ -427,7 +427,7 @@ impl<'a> TraitDef<'a> {
             bounds.push(cx.typarambound(trait_path.clone()));
 
             // also add in any bounds from the declaration
-            for declared_bound in ty_param.bounds.iter() {
+            for declared_bound in &*ty_param.bounds {
                 bounds.push((*declared_bound).clone());
             }
 
@@ -974,7 +974,7 @@ impl<'a> MethodDef<'a> {
                     subpats.push(p);
                     idents
                 };
-                for self_arg_name in self_arg_names.tail().iter() {
+                for self_arg_name in self_arg_names.tail() {
                     let (p, idents) = mk_self_pat(cx, &self_arg_name[]);
                     subpats.push(p);
                     self_pats_idents.push(idents);
diff --git a/src/libsyntax/ext/deriving/hash.rs b/src/libsyntax/ext/deriving/hash.rs
index e7f546b2691..efd93226618 100644
--- a/src/libsyntax/ext/deriving/hash.rs
+++ b/src/libsyntax/ext/deriving/hash.rs
@@ -100,7 +100,7 @@ fn hash_substructure(cx: &mut ExtCtxt, trait_span: Span, substr: &Substructure)
         _ => cx.span_bug(trait_span, "impossible substructure in `derive(Hash)`")
     };
 
-    for &FieldInfo { ref self_, span, .. } in fields.iter() {
+    for &FieldInfo { ref self_, span, .. } in fields {
         stmts.push(call_hash(span, self_.clone()));
     }
 
diff --git a/src/libsyntax/ext/deriving/primitive.rs b/src/libsyntax/ext/deriving/primitive.rs
index c694b054ba3..ae7b20f7853 100644
--- a/src/libsyntax/ext/deriving/primitive.rs
+++ b/src/libsyntax/ext/deriving/primitive.rs
@@ -93,7 +93,7 @@ fn cs_from(name: &str, cx: &mut ExtCtxt, trait_span: Span, substr: &Substructure
 
             let mut arms = Vec::new();
 
-            for variant in enum_def.variants.iter() {
+            for variant in &enum_def.variants {
                 match variant.node.kind {
                     ast::TupleVariantKind(ref args) => {
                         if !args.is_empty() {
diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs
index 68723d32739..6eacb344018 100644
--- a/src/libsyntax/ext/expand.rs
+++ b/src/libsyntax/ext/expand.rs
@@ -504,7 +504,7 @@ fn expand_item_modifiers(mut it: P<ast::Item>, fld: &mut MacroExpander)
         return it.expect_item();
     }
 
-    for attr in modifiers.iter() {
+    for attr in &modifiers {
         let mname = attr.name();
 
         match fld.cx.syntax_env.find(&intern(mname.get())) {
@@ -552,7 +552,7 @@ fn expand_item_underscore(item: ast::Item_, fld: &mut MacroExpander) -> ast::Ite
 
 // does this attribute list contain "macro_use" ?
 fn contains_macro_use(fld: &mut MacroExpander, attrs: &[ast::Attribute]) -> bool {
-    for attr in attrs.iter() {
+    for attr in attrs {
         let mut is_use = attr.check_name("macro_use");
         if attr.check_name("macro_escape") {
             fld.cx.span_warn(attr.span, "macro_escape is a deprecated synonym for macro_use");
@@ -853,7 +853,7 @@ impl<'v> Visitor<'v> for PatIdentFinder {
             ast::Pat { id: _, node: ast::PatIdent(_, ref path1, ref inner), span: _ } => {
                 self.ident_accumulator.push(path1.node);
                 // visit optional subpattern of PatIdent:
-                for subpat in inner.iter() {
+                if let Some(ref subpat) = *inner {
                     self.visit_pat(&**subpat)
                 }
             }
@@ -873,7 +873,7 @@ fn pattern_bindings(pat: &ast::Pat) -> Vec<ast::Ident> {
 /// find the PatIdent paths in a
 fn fn_decl_arg_bindings(fn_decl: &ast::FnDecl) -> Vec<ast::Ident> {
     let mut pat_idents = PatIdentFinder{ident_accumulator:Vec::new()};
-    for arg in fn_decl.inputs.iter() {
+    for arg in &fn_decl.inputs {
         pat_idents.visit_pat(&*arg.pat);
     }
     pat_idents.ident_accumulator
@@ -1063,7 +1063,7 @@ fn expand_annotatable(a: Annotatable,
 
     let mut decorator_items = SmallVector::zero();
     let mut new_attrs = Vec::new();
-    for attr in a.attrs().iter() {
+    for attr in a.attrs() {
         let mname = attr.name();
 
         match fld.cx.syntax_env.find(&intern(mname.get())) {
@@ -1218,7 +1218,7 @@ fn expand_item_multi_modifier(mut it: Annotatable,
         return it
     }
 
-    for attr in modifiers.iter() {
+    for attr in &modifiers {
         let mname = attr.name();
 
         match fld.cx.syntax_env.find(&intern(mname.get())) {
@@ -1420,11 +1420,11 @@ pub fn expand_crate(parse_sess: &parse::ParseSess,
     let mut cx = ExtCtxt::new(parse_sess, c.config.clone(), cfg);
     let mut expander = MacroExpander::new(&mut cx);
 
-    for def in imported_macros.into_iter() {
+    for def in imported_macros {
         expander.cx.insert_macro(def);
     }
 
-    for (name, extension) in user_exts.into_iter() {
+    for (name, extension) in user_exts {
         expander.cx.syntax_env.insert(name, extension);
     }
 
diff --git a/src/libsyntax/ext/format.rs b/src/libsyntax/ext/format.rs
index 36dbf117604..16aaccb0207 100644
--- a/src/libsyntax/ext/format.rs
+++ b/src/libsyntax/ext/format.rs
@@ -499,7 +499,7 @@ impl<'a, 'b> Context<'a, 'b> {
                                             self.ecx.expr_ident(e.span, name)));
             heads.push(self.ecx.expr_addr_of(e.span, e));
         }
-        for name in self.name_ordering.iter() {
+        for name in &self.name_ordering {
             let e = match self.names.remove(name) {
                 Some(e) => e,
                 None => continue
@@ -706,7 +706,7 @@ pub fn expand_preparsed_format_args(ecx: &mut ExtCtxt, sp: Span,
             cx.ecx.span_err(cx.args[i].span, "argument never used");
         }
     }
-    for (name, e) in cx.names.iter() {
+    for (name, e) in &cx.names {
         if !cx.name_types.contains_key(name) {
             cx.ecx.span_err(e.span, "named argument never used");
         }
diff --git a/src/libsyntax/ext/quote.rs b/src/libsyntax/ext/quote.rs
index 1d22f79bfb2..9092169e182 100644
--- a/src/libsyntax/ext/quote.rs
+++ b/src/libsyntax/ext/quote.rs
@@ -694,7 +694,7 @@ fn mk_tt(cx: &ExtCtxt, tt: &ast::TokenTree) -> Vec<P<ast::Stmt>> {
 
 fn mk_tts(cx: &ExtCtxt, tts: &[ast::TokenTree]) -> Vec<P<ast::Stmt>> {
     let mut ss = Vec::new();
-    for tt in tts.iter() {
+    for tt in tts {
         ss.extend(mk_tt(cx, tt).into_iter());
     }
     ss
diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs
index 69c7d10a82c..823efdd3eed 100644
--- a/src/libsyntax/ext/tt/macro_parser.rs
+++ b/src/libsyntax/ext/tt/macro_parser.rs
@@ -209,12 +209,12 @@ pub fn nameize(p_s: &ParseSess, ms: &[TokenTree], res: &[Rc<NamedMatch>])
              ret_val: &mut HashMap<Ident, Rc<NamedMatch>>, idx: &mut usize) {
         match m {
             &TtSequence(_, ref seq) => {
-                for next_m in seq.tts.iter() {
+                for next_m in &seq.tts {
                     n_rec(p_s, next_m, res, ret_val, idx)
                 }
             }
             &TtDelimited(_, ref delim) => {
-                for next_m in delim.tts.iter() {
+                for next_m in &delim.tts {
                     n_rec(p_s, next_m, res, ret_val, idx)
                 }
             }
@@ -239,7 +239,7 @@ pub fn nameize(p_s: &ParseSess, ms: &[TokenTree], res: &[Rc<NamedMatch>])
     }
     let mut ret_val = HashMap::new();
     let mut idx = 0;
-    for m in ms.iter() { n_rec(p_s, m, res, &mut ret_val, &mut idx) }
+    for m in ms { n_rec(p_s, m, res, &mut ret_val, &mut idx) }
     ret_val
 }
 
@@ -444,7 +444,7 @@ pub fn parse(sess: &ParseSess,
         if token_name_eq(&tok, &token::Eof) {
             if eof_eis.len() == 1 {
                 let mut v = Vec::new();
-                for dv in (&mut eof_eis[0]).matches.iter_mut() {
+                for dv in &mut (&mut eof_eis[0]).matches {
                     v.push(dv.pop().unwrap());
                 }
                 return Success(nameize(sess, ms, &v[]));
diff --git a/src/libsyntax/ext/tt/macro_rules.rs b/src/libsyntax/ext/tt/macro_rules.rs
index 666281ac6b6..ac9f375e0a4 100644
--- a/src/libsyntax/ext/tt/macro_rules.rs
+++ b/src/libsyntax/ext/tt/macro_rules.rs
@@ -259,7 +259,7 @@ pub fn compile<'cx>(cx: &'cx mut ExtCtxt,
         _ => cx.span_bug(def.span, "wrong-structured lhs")
     };
 
-    for lhs in lhses.iter() {
+    for lhs in &lhses {
         check_lhs_nt_follows(cx, &**lhs, def.span);
     }