]> git.lizzy.rs Git - rust.git/commitdiff
`for x in xs.into_iter()` -> `for x in xs`
authorJorge Aparicio <japaricious@gmail.com>
Sun, 1 Feb 2015 01:03:04 +0000 (20:03 -0500)
committerJorge Aparicio <japaricious@gmail.com>
Mon, 2 Feb 2015 18:40:18 +0000 (13:40 -0500)
Also `for x in option.into_iter()` -> `if let Some(x) = option`

60 files changed:
src/compiletest/procsrv.rs
src/compiletest/runtest.rs
src/libcollections/btree/map.rs
src/libcollections/dlist.rs
src/libcollections/slice.rs
src/libcollections/vec.rs
src/libcollections/vec_map.rs
src/libcore/fmt/mod.rs
src/librustc/lint/context.rs
src/librustc/metadata/encoder.rs
src/librustc/metadata/loader.rs
src/librustc/middle/check_match.rs
src/librustc/middle/dead.rs
src/librustc/middle/subst.rs
src/librustc/middle/traits/fulfill.rs
src/librustc/middle/traits/mod.rs
src/librustc/plugin/load.rs
src/librustc/session/config.rs
src/librustc_driver/driver.rs
src/librustc_driver/lib.rs
src/librustc_resolve/lib.rs
src/librustc_trans/back/link.rs
src/librustc_trans/back/lto.rs
src/librustc_trans/back/write.rs
src/librustc_trans/trans/callee.rs
src/librustc_trans/trans/monomorphize.rs
src/librustc_typeck/astconv.rs
src/librustc_typeck/check/assoc.rs
src/librustc_typeck/check/compare_method.rs
src/librustc_typeck/check/method/probe.rs
src/librustc_typeck/check/vtable.rs
src/librustc_typeck/check/wf.rs
src/librustc_typeck/collect.rs
src/librustdoc/html/render.rs
src/librustdoc/lib.rs
src/libserialize/json.rs
src/libstd/old_io/fs.rs
src/libstd/old_io/net/mod.rs
src/libstd/rt/at_exit_imp.rs
src/libstd/sync/rwlock.rs
src/libstd/sys/windows/process.rs
src/libsyntax/attr.rs
src/libsyntax/ext/concat.rs
src/libsyntax/ext/expand.rs
src/libsyntax/parse/parser.rs
src/libsyntax/print/pprust.rs
src/libtest/lib.rs
src/rustbook/build.rs
src/rustbook/test.rs
src/test/bench/msgsend-pipes-shared.rs
src/test/bench/msgsend-pipes.rs
src/test/bench/shootout-binarytrees.rs
src/test/bench/shootout-fannkuch-redux.rs
src/test/bench/shootout-k-nucleotide.rs
src/test/bench/shootout-mandelbrot.rs
src/test/bench/shootout-pfib.rs
src/test/debuginfo/destructured-for-loop-variable.rs
src/test/run-pass/task-comm-3.rs
src/test/run-pass/unboxed-closures-counter-not-moved.rs
src/test/run-pass/unboxed-closures-move-some-upvars-in-by-ref-closure.rs

index 57f4171f7c2d119cb2f0bff6c5c72617a0798dc0..4b0eea33d69b7a2176cd0c0c86d1480f43409c48 100644 (file)
@@ -40,7 +40,7 @@ pub fn run(lib_path: &str,
     let mut cmd = Command::new(prog);
     cmd.args(args);
     add_target_env(&mut cmd, lib_path, aux_path);
-    for (key, val) in env.into_iter() {
+    for (key, val) in env {
         cmd.env(key, val);
     }
 
@@ -72,7 +72,7 @@ pub fn run_background(lib_path: &str,
     let mut cmd = Command::new(prog);
     cmd.args(args);
     add_target_env(&mut cmd, lib_path, aux_path);
-    for (key, val) in env.into_iter() {
+    for (key, val) in env {
         cmd.env(key, val);
     }
 
index 2143cf22e0528b733b153489f2cce36d369f34ec..3022973d9c1fa1648966459980fcada3f1ab10d7 100644 (file)
@@ -1503,7 +1503,7 @@ fn _arm_exec_compiled_test(config: &Config,
 
     // run test via adb_run_wrapper
     runargs.push("shell".to_string());
-    for (key, val) in env.into_iter() {
+    for (key, val) in env {
         runargs.push(format!("{}={}", key, val));
     }
     runargs.push(format!("{}/adb_run_wrapper.sh", config.adb_test_dir));
index bc657a19d785ce1d3c875fc005016498467a0496..23eab79e6a4ef6acfae9e0a3b1e3588c36230694 100644 (file)
@@ -197,7 +197,7 @@ pub fn with_b(b: uint) -> BTreeMap<K, V> {
     pub fn clear(&mut self) {
         let b = self.b;
         // avoid recursive destructors by manually traversing the tree
-        for _ in mem::replace(self, BTreeMap::with_b(b)).into_iter() {};
+        for _ in mem::replace(self, BTreeMap::with_b(b)) {};
     }
 
     // Searching in a B-Tree is pretty straightforward.
index e229cd8a9613d4e00b954d2b309bfe42b720e54a..c6c8a6e4a1ecf2b00c6c99a25ea46b7c7b34dff9 100644 (file)
@@ -1061,7 +1061,7 @@ fn test_append() {
         let mut sum = v;
         sum.push_all(u.as_slice());
         assert_eq!(sum.len(), m.len());
-        for elt in sum.into_iter() {
+        for elt in sum {
             assert_eq!(m.pop_front(), Some(elt))
         }
         assert_eq!(n.len(), 0);
index 3830ab9ee7b17f15af3ba1be136c1b867bbc2f3e..4b4ea3e4c3ca539729dc22c657aabc7be7221a67 100644 (file)
@@ -2699,7 +2699,7 @@ fn test_iter_zero_sized() {
         }
         assert_eq!(cnt, 8);
 
-        for f in v.into_iter() {
+        for f in v {
             assert!(f == Foo);
             cnt += 1;
         }
index acf4b480dfb5539632aa20a7c847b91baeef4ba7..22b0e0f7cc90762d2efe81d692378f6e1e0a44f4 100644 (file)
@@ -2333,7 +2333,7 @@ fn drop(&mut self) {
     fn test_move_items() {
         let vec = vec![1, 2, 3];
         let mut vec2 : Vec<i32> = vec![];
-        for i in vec.into_iter() {
+        for i in vec {
             vec2.push(i);
         }
         assert!(vec2 == vec![1, 2, 3]);
@@ -2353,7 +2353,7 @@ fn test_move_items_reverse() {
     fn test_move_items_zero_sized() {
         let vec = vec![(), (), ()];
         let mut vec2 : Vec<()> = vec![];
-        for i in vec.into_iter() {
+        for i in vec {
             vec2.push(i);
         }
         assert!(vec2 == vec![(), (), ()]);
index b07e172079e5774ec1da4ba89c4ee1f840f6e24c..e480d29541e368d8a52ddfbc1a912772e46e6071 100644 (file)
@@ -984,7 +984,7 @@ fn test_move_iter() {
         let mut m = VecMap::new();
         m.insert(1, box 2);
         let mut called = false;
-        for (k, v) in m.into_iter() {
+        for (k, v) in m {
             assert!(!called);
             called = true;
             assert_eq!(k, 1);
index 20ef30b0a3e3d87cc06d92bd2bfd9563c12f4b4a..ead49af18d03f27c5f19813b87cbbf7b1ee99629 100644 (file)
@@ -482,7 +482,7 @@ pub fn pad_integral(&mut self,
 
         // Writes the sign if it exists, and then the prefix if it was requested
         let write_prefix = |&: f: &mut Formatter| {
-            for c in sign.into_iter() {
+            if let Some(c) = sign {
                 let mut b = [0; 4];
                 let n = c.encode_utf8(&mut b).unwrap_or(0);
                 let b = unsafe { str::from_utf8_unchecked(&b[..n]) };
index 2bc29e61d0d2b2493e753f3bd5ba6ffdece21eee..91dba90b0d2e2508d1da2c9e571ca0c7096fd6c1 100644 (file)
@@ -417,11 +417,11 @@ pub fn raw_emit_lint(sess: &Session, lint: &'static Lint,
         _ => sess.bug("impossible level in raw_emit_lint"),
     }
 
-    for note in note.into_iter() {
+    if let Some(note) = note {
         sess.note(&note[]);
     }
 
-    for span in def.into_iter() {
+    if let Some(span) = def {
         sess.span_note(span, "lint level defined here");
     }
 }
@@ -492,7 +492,7 @@ fn with_lint_attrs<F>(&mut self,
         // specified closure
         let mut pushed = 0;
 
-        for result in gather_attrs(attrs).into_iter() {
+        for result in gather_attrs(attrs) {
             let v = match result {
                 Err(span) => {
                     self.tcx.sess.span_err(span, "malformed lint attribute");
@@ -519,7 +519,7 @@ fn with_lint_attrs<F>(&mut self,
                 }
             };
 
-            for (lint_id, level, span) in v.into_iter() {
+            for (lint_id, level, span) in v {
                 let now = self.lints.get_level_source(lint_id).0;
                 if now == Forbid && level != Forbid {
                     let lint_name = lint_id.as_str();
@@ -727,7 +727,7 @@ fn visit_id(&mut self, id: ast::NodeId) {
         match self.tcx.sess.lints.borrow_mut().remove(&id) {
             None => {}
             Some(lints) => {
-                for (lint_id, span, msg) in lints.into_iter() {
+                for (lint_id, span, msg) in lints {
                     self.span_lint(lint_id.lint, span, &msg[])
                 }
             }
index 117ab4c8a5aba7836f82a12b188545c54f689e20..ccd524a2c03955a950b3929a96dae1659de9fffc 100644 (file)
@@ -1589,7 +1589,7 @@ fn encode_index<T, F>(rbml_w: &mut Encoder, index: Vec<entry<T>>, mut write_fn:
     T: Hash<SipHasher>,
 {
     let mut buckets: Vec<Vec<entry<T>>> = (0..256u16).map(|_| Vec::new()).collect();
-    for elt in index.into_iter() {
+    for elt in index {
         let mut s = SipHasher::new();
         elt.val.hash(&mut s);
         let h = s.finish() as uint;
index f219bfffcb8070ecd4204aed08d169cc2b10c5d9..30b783cd5098229af5db5cfade719758f956a1d7 100644 (file)
@@ -425,7 +425,7 @@ fn find_library_crate(&mut self) -> Option<Library> {
         // libraries corresponds to the crate id and hash criteria that this
         // search is being performed for.
         let mut libraries = Vec::new();
-        for (_hash, (rlibs, dylibs)) in candidates.into_iter() {
+        for (_hash, (rlibs, dylibs)) in candidates {
             let mut metadata = None;
             let rlib = self.extract_one(rlibs, "rlib", &mut metadata);
             let dylib = self.extract_one(dylibs, "dylib", &mut metadata);
@@ -501,7 +501,7 @@ fn extract_one(&mut self, m: HashMap<Path, PathKind>, flavor: &str,
             }
         }
 
-        for (lib, kind) in m.into_iter() {
+        for (lib, kind) in m {
             info!("{} reading metadata from: {}", flavor, lib.display());
             let metadata = match get_metadata_section(self.target.options.is_like_osx,
                                                       &lib) {
index 72551daa4e652cc724a4f3774f66b3926766ca53..38084d1c2c06fe42aa067491284e23e4a7a5707c 100644 (file)
@@ -77,7 +77,7 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         let total_width = column_widths.iter().map(|n| *n).sum() + column_count * 3 + 1;
         let br = repeat('+').take(total_width).collect::<String>();
         try!(write!(f, "{}\n", br));
-        for row in pretty_printed_matrix.into_iter() {
+        for row in pretty_printed_matrix {
             try!(write!(f, "+"));
             for (column, pat_str) in row.into_iter().enumerate() {
                 try!(write!(f, " "));
index 6bad7f59441976147f24b9f9dddb545625f1aa95..4478e3270874dc43b8642a64b563f260d40afb68 100644 (file)
@@ -318,7 +318,7 @@ fn has_allow_dead_code_or_lang_attr(attrs: &[ast::Attribute]) -> bool {
     }
 
     let dead_code = lint::builtin::DEAD_CODE.name_lower();
-    for attr in lint::gather_attrs(attrs).into_iter() {
+    for attr in lint::gather_attrs(attrs) {
         match attr {
             Ok((ref name, lint::Allow, _))
                 if name.get() == dead_code => return true,
index 2cf8a83db9bedac810175e0ffed2ee466890b242..43319540c4ea94a63de47890c500bd9b40b845d5 100644 (file)
@@ -352,7 +352,7 @@ pub fn truncate(&mut self, space: ParamSpace, len: uint) {
     pub fn replace(&mut self, space: ParamSpace, elems: Vec<T>) {
         // FIXME (#15435): slow; O(n^2); could enhance vec to make it O(n).
         self.truncate(space, 0);
-        for t in elems.into_iter() {
+        for t in elems {
             self.push(space, t);
         }
     }
index ed0582804831a3767882cb105d9278cb81c19416..8adcd256ccebcccc825e70aa72fa7dee0b608918 100644 (file)
@@ -125,7 +125,7 @@ pub fn normalize_projection_type<'a>(&mut self,
         let mut selcx = SelectionContext::new(infcx, typer);
         let normalized = project::normalize_projection_type(&mut selcx, projection_ty, cause, 0);
 
-        for obligation in normalized.obligations.into_iter() {
+        for obligation in normalized.obligations {
             self.register_predicate_obligation(infcx, obligation);
         }
 
@@ -289,7 +289,7 @@ fn select<'a>(&mut self,
 
             // Now go through all the successful ones,
             // registering any nested obligations for the future.
-            for new_obligation in new_obligations.into_iter() {
+            for new_obligation in new_obligations {
                 self.register_predicate_obligation(selcx.infcx(), new_obligation);
             }
         }
index 94da688181e1b5c9de17eeda26009f3794da8d93..f69bf31626f628591c721d2d3628988c470e9ddd 100644 (file)
@@ -438,7 +438,7 @@ pub fn normalize_param_env<'a,'tcx>(param_env: &ty::ParameterEnvironment<'a,'tcx
         let mut fulfill_cx = FulfillmentContext::new();
         let Normalized { value: predicates, obligations } =
             project::normalize(selcx, cause, &param_env.caller_bounds);
-        for obligation in obligations.into_iter() {
+        for obligation in obligations {
             fulfill_cx.register_predicate_obligation(selcx.infcx(), obligation);
         }
         try!(fulfill_cx.select_all_or_error(selcx.infcx(), param_env));
index 22edd7c691ac7d531d215847fcf4cc1eb4f86c6d..b9bf577b38e62fc479259241cdd1a353ed37b2c6 100644 (file)
@@ -204,7 +204,7 @@ pub fn load_plugin<'b>(&mut self,
             }
         }
 
-        for mut def in macros.into_iter() {
+        for mut def in macros {
             let name = token::get_ident(def.ident);
             def.use_locally = match macro_selection.as_ref() {
                 None => true,
index afeb123b7a5d268712e568cc7d813e603ec111ef..88f6dc673cf18f8e4b8ab2aaf97e92b03c840272 100644 (file)
@@ -300,7 +300,7 @@ pub fn $defaultfn() -> $struct_name {
     pub fn $buildfn(matches: &getopts::Matches) -> $struct_name
     {
         let mut op = $defaultfn();
-        for option in matches.opt_strs($prefix).into_iter() {
+        for option in matches.opt_strs($prefix) {
             let mut iter = option.splitn(1, '=');
             let key = iter.next().unwrap();
             let value = iter.next();
@@ -831,7 +831,7 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options {
     let mut describe_lints = false;
 
     for &level in &[lint::Allow, lint::Warn, lint::Deny, lint::Forbid] {
-        for lint_name in matches.opt_strs(level.as_str()).into_iter() {
+        for lint_name in matches.opt_strs(level.as_str()) {
             if lint_name == "help" {
                 describe_lints = true;
             } else {
index e8ea349c3dbd5ec6bd7ee226167d63f453ec6f9e..8d73532cf52327963ec81140f0afc3cde617eb82 100644 (file)
@@ -424,7 +424,7 @@ pub fn phase_2_configure_and_expand(sess: &Session,
                 diagnostics::plugin::expand_build_diagnostic_array);
         }
 
-        for registrar in registrars.into_iter() {
+        for registrar in registrars {
             registry.args_hidden = Some(registrar.args);
             (registrar.fun)(&mut registry);
         }
@@ -434,11 +434,11 @@ pub fn phase_2_configure_and_expand(sess: &Session,
 
     {
         let mut ls = sess.lint_store.borrow_mut();
-        for pass in lint_passes.into_iter() {
+        for pass in lint_passes {
             ls.register_pass(Some(sess), true, pass);
         }
 
-        for (name, to) in lint_groups.into_iter() {
+        for (name, to) in lint_groups {
             ls.register_group(Some(sess), true, name, to);
         }
     }
index a8f5cfa6b3f47e6c31f9a4cb20366988fcef349a..794d66e66ab7321f4623fecf29e50be192957668 100644 (file)
@@ -373,7 +373,7 @@ fn sort_lint_groups(lints: Vec<(&'static str, Vec<lint::LintId>, bool)>)
     println!("    {}  {:7.7}  {}", padded("----"), "-------", "-------");
 
     let print_lints = |&: lints: Vec<&Lint>| {
-        for lint in lints.into_iter() {
+        for lint in lints {
             let name = lint.name_lower().replace("_", "-");
             println!("    {}  {:7.7}  {}",
                      padded(&name[]), lint.default_level.as_str(), lint.desc);
@@ -400,7 +400,7 @@ fn sort_lint_groups(lints: Vec<(&'static str, Vec<lint::LintId>, bool)>)
     println!("    {}  {}", padded("----"), "---------");
 
     let print_lint_groups = |&: lints: Vec<(&'static str, Vec<lint::LintId>)>| {
-        for (name, to) in lints.into_iter() {
+        for (name, to) in lints {
             let name = name.chars().map(|x| x.to_lowercase())
                            .collect::<String>().replace("_", "-");
             let desc = to.into_iter().map(|x| x.as_str().replace("_", "-"))
index c10b71242182a464bdc4f7bf027197686d455f0e..a5fb57eadc41d0901d6d4f77043c8292b5ee9f39 100644 (file)
@@ -3607,10 +3607,10 @@ fn resolve_type(&mut self, ty: &Ty) {
             TyQPath(ref qpath) => {
                 self.resolve_type(&*qpath.self_type);
                 self.resolve_trait_reference(ty.id, &*qpath.trait_ref, TraitQPath);
-                for ty in qpath.item_path.parameters.types().into_iter() {
+                for ty in qpath.item_path.parameters.types() {
                     self.resolve_type(&**ty);
                 }
-                for binding in qpath.item_path.parameters.bindings().into_iter() {
+                for binding in qpath.item_path.parameters.bindings() {
                     self.resolve_type(&*binding.ty);
                 }
             }
index eeb6d9fab5ea6be9826cb9e1685fa5709a7df65e..145cf46ad9daf02bfccf2c77d5a88fdf2f40948c 100644 (file)
@@ -1275,7 +1275,7 @@ fn add_upstream_native_libraries(cmd: &mut Command, sess: &Session) {
     // we're just getting an ordering of crate numbers, we're not worried about
     // the paths.
     let crates = sess.cstore.get_used_crates(cstore::RequireStatic);
-    for (cnum, _) in crates.into_iter() {
+    for (cnum, _) in crates {
         let libs = csearch::get_native_libraries(&sess.cstore, cnum);
         for &(kind, ref lib) in &libs {
             match kind {
index 1a5310bb0a8d94ddb93f1052c168889bf2cda40e..38c68bc9fa426005e6add8fc17fd3a2f29ade027 100644 (file)
@@ -48,7 +48,7 @@ pub fn run(sess: &session::Session, llmod: ModuleRef,
     // load the bitcode from the archive. Then merge it into the current LLVM
     // module that we've got.
     let crates = sess.cstore.get_used_crates(cstore::RequireStatic);
-    for (cnum, path) in crates.into_iter() {
+    for (cnum, path) in crates {
         let name = sess.cstore.get_crate_data(cnum).name.clone();
         let path = match path {
             Some(p) => p,
index c54e3e02d3c9182c95898d33cdde8ec11673eb55..5312d2ca1ddeee3d40675c631a80262e4b82599e 100644 (file)
@@ -941,7 +941,7 @@ fn run_work_multithreaded(sess: &Session,
     }
 
     let mut panicked = false;
-    for rx in futures.into_iter() {
+    for rx in futures {
         match rx.recv() {
             Ok(()) => {},
             Err(_) => {
index 5f3cb01d76274c0dfeef4481a4f8e21b647d2e85..5f383d54a68ca5d355fb45fc49e90335dd245dfb 100644 (file)
@@ -1045,7 +1045,7 @@ pub fn trans_args<'a, 'blk, 'tcx>(cx: Block<'blk, 'tcx>,
             }));
 
             assert_eq!(arg_tys.len(), 1 + rhs.len());
-            for (rhs, rhs_id) in rhs.into_iter() {
+            for (rhs, rhs_id) in rhs {
                 llargs.push(unpack_result!(bcx, {
                     trans_arg_datum(bcx, arg_tys[1], rhs,
                                     arg_cleanup_scope,
index cc0d76efcf0a683767a3d684b3396c0a2e4b55df..b3d388b0f0236b3e8f257db91d197b44fceba0bd 100644 (file)
@@ -333,7 +333,7 @@ pub fn normalize_associated_type<'tcx,T>(tcx: &ty::ctxt<'tcx>, value: &T) -> T
            obligations.repr(tcx));
 
     let mut fulfill_cx = traits::FulfillmentContext::new();
-    for obligation in obligations.into_iter() {
+    for obligation in obligations {
         fulfill_cx.register_predicate_obligation(&infcx, obligation);
     }
     let result = drain_fulfillment_cx(DUMMY_SP, &infcx, &mut fulfill_cx, &result);
index 3bf34dfcd7013b37cf8ef7f3a6f01fe942d1cc0c..8809931cd80c23b23f81096be36772dd5b33d520 100644 (file)
@@ -537,7 +537,7 @@ pub fn instantiate_poly_trait_ref<'tcx>(
         instantiate_trait_ref(this, &shifted_rscope, &ast_trait_ref.trait_ref,
                               self_ty, Some(&mut projections));
 
-    for projection in projections.into_iter() {
+    for projection in projections {
         poly_projections.push(ty::Binder(projection));
     }
 
index 0e0a929464018a2a9bfc09eade851876feb8c805..377af080526b7084a961c372de6535587d5cb511 100644 (file)
@@ -33,7 +33,7 @@ pub fn normalize_associated_types_in<'a,'tcx,T>(infcx: &InferCtxt<'a,'tcx>,
     debug!("normalize_associated_types_in: result={} predicates={}",
            result.repr(infcx.tcx),
            obligations.repr(infcx.tcx));
-    for obligation in obligations.into_iter() {
+    for obligation in obligations {
         fulfillment_cx.register_predicate_obligation(infcx, obligation);
     }
     result
index 31b14ea3f3dec8aba90473b559b4bed584afcd98..dc4d7d466472800a9ddb633e0207c32e5be7c9e4 100644 (file)
@@ -248,7 +248,7 @@ pub fn compare_impl_method<'tcx>(tcx: &ty::ctxt<'tcx>,
 
     let mut selcx = traits::SelectionContext::new(&infcx, &trait_param_env);
 
-    for predicate in impl_pred.fns.into_iter() {
+    for predicate in impl_pred.fns {
         let traits::Normalized { value: predicate, .. } =
             traits::normalize(&mut selcx, normalize_cause.clone(), &predicate);
 
index 8ad67b4317883b086badc3f188034211739b2776..a988fb4cc6e19015e0b58ec43b737db33bbd6742 100644 (file)
@@ -448,7 +448,7 @@ fn assemble_extension_candidates_for_traits_in_scope(&mut self,
     {
         let mut duplicates = HashSet::new();
         let opt_applicable_traits = self.fcx.ccx.trait_map.get(&expr_id);
-        for applicable_traits in opt_applicable_traits.into_iter() {
+        if let Some(applicable_traits) = opt_applicable_traits {
             for &trait_did in applicable_traits {
                 if duplicates.insert(trait_did) {
                     try!(self.assemble_extension_candidates_for_trait(trait_did));
index 43910a937e8c5ad80b55773d85f1fbc6758a4c17..6f66010925ec0b5411d059312947ce6bdb08c573 100644 (file)
@@ -142,7 +142,7 @@ pub fn check_object_safety<'tcx>(tcx: &ty::ctxt<'tcx>,
               ty::item_path_str(tcx, object_trait_ref.def_id()));
 
     let violations = traits::object_safety_violations(tcx, object_trait_ref.clone());
-    for violation in violations.into_iter() {
+    for violation in violations {
         match violation {
             ObjectSafetyViolation::SizedSelf => {
                 tcx.sess.span_note(
@@ -269,7 +269,7 @@ fn check_object_type_binds_all_associated_types<'tcx>(tcx: &ty::ctxt<'tcx>,
         associated_types.remove(&pair);
     }
 
-    for (trait_def_id, name) in associated_types.into_iter() {
+    for (trait_def_id, name) in associated_types {
         span_err!(tcx.sess, span, E0191,
             "the value of the associated type `{}` (from the trait `{}`) must be specified",
                     name.user_string(tcx),
index 24153fd94ea6fd0b0fdd035f8b69b307cb7b2736..71b495af444dd240f313e5a53f59ecedd489355c 100644 (file)
@@ -268,10 +268,10 @@ fn check_impl(&mut self,
                 let selcx = &mut traits::SelectionContext::new(fcx.infcx(), fcx);
                 traits::normalize(selcx, cause.clone(), &predicates)
             };
-            for predicate in predicates.value.into_iter() {
+            for predicate in predicates.value {
                 fcx.register_predicate(traits::Obligation::new(cause.clone(), predicate));
             }
-            for obligation in predicates.obligations.into_iter() {
+            for obligation in predicates.obligations {
                 fcx.register_predicate(obligation);
             }
         });
index 6d92343d332b328832d88087f07b54e91a9722a3..4114e92a0969f70d14183ed88288feaa8689582f 100644 (file)
@@ -1109,7 +1109,7 @@ fn ty_generics_for_trait<'a, 'tcx>(ccx: &CollectCtxt<'a, 'tcx>,
 
     debug!("ty_generics_for_trait: assoc_predicates={}", assoc_predicates.repr(ccx.tcx));
 
-    for assoc_predicate in assoc_predicates.into_iter() {
+    for assoc_predicate in assoc_predicates {
         generics.predicates.push(subst::TypeSpace, assoc_predicate);
     }
 
@@ -1310,7 +1310,7 @@ fn create_predicates<'tcx>(
     {
         for type_param_def in result.types.get_slice(space) {
             let param_ty = ty::mk_param_from_def(tcx, type_param_def);
-            for predicate in ty::predicates(tcx, param_ty, &type_param_def.bounds).into_iter() {
+            for predicate in ty::predicates(tcx, param_ty, &type_param_def.bounds) {
                 result.predicates.push(space, predicate);
             }
         }
index 80e72777f9381856a16517233ae53e45ee752bee..6247c6dad1496dd23b3e2a9fce432e2427621e94 100644 (file)
@@ -1231,7 +1231,7 @@ fn render(w: old_io::File, cx: &Context, it: &clean::Item,
                         _ => unreachable!()
                     };
                     this.sidebar = this.build_sidebar(&m);
-                    for item in m.items.into_iter() {
+                    for item in m.items {
                         f(this,item);
                     }
                     Ok(())
index 9efd7cfb2e2dde3504f668efc5f89abd7df04e5b..531e798a59f9bf7bec895c0e97c468a8eaf4c06a 100644 (file)
@@ -431,7 +431,7 @@ fn rust_input(cratefile: &str, externs: core::Externs, matches: &getopts::Matche
         pm.add_plugin(plugin);
     }
     info!("loading plugins...");
-    for pname in plugins.into_iter() {
+    for pname in plugins {
         pm.load_plugin(pname);
     }
 
index f43f22ec57c0ce4661c09e89fc5e0667051681ef..3bc9e699035da3b2f70eef1f2f2bb23aa87a69b4 100644 (file)
@@ -2371,7 +2371,7 @@ fn read_map<T, F>(&mut self, f: F) -> DecodeResult<T> where
     {
         let obj = try!(expect!(self.pop(), Object));
         let len = obj.len();
-        for (key, value) in obj.into_iter() {
+        for (key, value) in obj {
             self.stack.push(value);
             self.stack.push(Json::String(key));
         }
index 142f723ef716c42d56f9ae2e15f97db69f2e6d4e..e1006f23996f2fa9e153f619ef3bd4a918695714 100644 (file)
@@ -649,7 +649,7 @@ fn update_err<T>(err: IoResult<T>, path: &Path) -> IoResult<T> {
 
         // delete all regular files in the way and push subdirs
         // on the stack
-        for child in children.into_iter() {
+        for child in children {
             // FIXME(#12795) we should use lstat in all cases
             let child_type = match cfg!(windows) {
                 true => try!(update_err(stat(&child), path)),
index d8394aa8b6a44b4c8e54e7f19ed84970fac85f77..bbe3a71dcc0d17a12057884758c81e22de430900 100644 (file)
@@ -36,7 +36,7 @@ fn with_addresses<A, T, F>(addr: A, mut action: F) -> IoResult<T> where
 
     let addresses = try!(addr.to_socket_addr_all());
     let mut err = DEFAULT_ERROR;
-    for addr in addresses.into_iter() {
+    for addr in addresses {
         match action(addr) {
             Ok(r) => return Ok(r),
             Err(e) => err = e
index 5823f8453d84a3ffc8f87d7f2efe137db6786932..3f15cf71ec3f74974e2f1fc8397ae1f9144c294b 100644 (file)
@@ -58,7 +58,7 @@ pub fn cleanup() {
         // If we never called init, not need to cleanup!
         if queue as uint != 0 {
             let queue: Box<Queue> = mem::transmute(queue);
-            for to_run in queue.into_iter() {
+            for to_run in *queue {
                 to_run.invoke(());
             }
         }
index 95b570dd9c82a858bd7e5e46a3b2c5fd675c9548..2dfc708e15bebdc7386d96469e0451551b651251 100644 (file)
@@ -508,7 +508,7 @@ fn test_rw_arc() {
         }
 
         // Wait for children to pass their asserts
-        for r in children.into_iter() {
+        for r in children {
             assert!(r.join().is_ok());
         }
 
index a0a0c08ed09110da0ff6ab1c5f2f0bc3957fd458..58797111a20710526334b87490d5e7945e021850 100644 (file)
@@ -147,7 +147,7 @@ pub fn spawn<K, V, C, P>(cfg: &C, in_fd: Option<P>,
 
                 // Split the value and test each path to see if the
                 // program exists.
-                for path in os::split_paths(v.container_as_bytes()).into_iter() {
+                for path in os::split_paths(v.container_as_bytes()) {
                     let path = path.join(cfg.program().as_bytes())
                                    .with_extension(os::consts::EXE_EXTENSION);
                     if path.exists() {
index 61ddd240abcd4aea3098c8e482e0e22e95e4f52e..e5cd6f636905b25375ccb5661328ca13fa7cd7ad 100644 (file)
@@ -490,7 +490,7 @@ fn find_stability_generic<'a,
 pub fn find_stability(diagnostic: &SpanHandler, attrs: &[Attribute],
                       item_sp: Span) -> Option<Stability> {
     let (s, used) = find_stability_generic(diagnostic, attrs.iter(), item_sp);
-    for used in used.into_iter() { mark_used(used) }
+    for used in used { mark_used(used) }
     return s;
 }
 
index 39895a3946a564397fa4c5fbceb991cfe6b9e125..4e10cc9aacc08cf1e625f3b10e890d5153fb165f 100644 (file)
@@ -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 {
index 8b4816f5d2bc09979161144958c00db58994eff0..2787339aac0316929716ecb7d38d98853da9d9b0 100644 (file)
@@ -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);
     }
 
index b7960d9e709a5473ab3237149e71373b778bf3bd..27fd803d3fe5bda59542a548e733541ff1b5f9e6 100644 (file)
@@ -5445,7 +5445,7 @@ fn parse_enum_def(&mut self, _generics: &ast::Generics) -> EnumDef {
                     seq_sep_trailing_allowed(token::Comma),
                     |p| p.parse_ty_sum()
                 );
-                for ty in arg_tys.into_iter() {
+                for ty in arg_tys {
                     args.push(ast::VariantArg {
                         ty: ty,
                         id: ast::DUMMY_NODE_ID,
index 21cd02b3851da0e3d511bd329fdbed50a7e8cdce..5c42485f239a524f548d52287781ab45ef0e3b8f 100644 (file)
@@ -966,7 +966,7 @@ pub fn print_item(&mut self, item: &ast::Item) -> IoResult<()> {
                 try!(self.print_generics(generics));
                 let bounds: Vec<_> = bounds.iter().map(|b| b.clone()).collect();
                 let mut real_bounds = Vec::with_capacity(bounds.len());
-                for b in bounds.into_iter() {
+                for b in bounds {
                     if let TraitTyParamBound(ref ptr, ast::TraitBoundModifier::Maybe) = b {
                         try!(space(&mut self.s));
                         try!(self.word_space("for ?"));
index 63969e996d3164b66742341320ec9ab235a4d9fe..25377e3afa179178b870c1ed949e35643fe70809 100644 (file)
@@ -806,7 +806,7 @@ fn run_tests<F>(opts: &TestOpts,
 
     // All benchmarks run at the end, in serial.
     // (this includes metric fns)
-    for b in filtered_benchs_and_metrics.into_iter() {
+    for b in filtered_benchs_and_metrics {
         try!(callback(TeWait(b.desc.clone(), b.testfn.padding())));
         run_test(opts, !opts.run_benchmarks, b, tx.clone());
         let (test, result, stdout) = rx.recv().unwrap();
index ccb572a113a4948560840a2eddf9e7b0f372631b..3c9c4bdedcc876febdf62a64dfaa8698ece966c4 100644 (file)
@@ -177,7 +177,7 @@ fn execute(&mut self, term: &mut Term) -> CommandResult<()> {
             }
             Err(errors) => {
                 let n = errors.len();
-                for err in errors.into_iter() {
+                for err in errors {
                     term.err(&format!("error: {}", err)[]);
                 }
 
index db02481cb0297145e05e51374ce4c4eaabcf6630..d3cb8a7316e8640178eb2c8fb7d726f0c66e857b 100644 (file)
@@ -64,7 +64,7 @@ fn execute(&mut self, term: &mut Term) -> CommandResult<()> {
                 }
             }
             Err(errors) => {
-                for err in errors.into_iter() {
+                for err in errors {
                     term.err(&err[]);
                 }
                 return Err(box "There was an error." as Box<Error>);
index 6928397566dd0cee7cc619b1358d3972dc1cf870..259b4d9418dcf428b5bf8312db7fa43e09cf1571 100644 (file)
@@ -75,7 +75,7 @@ fn run(args: &[String]) {
             server(&from_parent, &to_parent);
         });
 
-        for r in worker_results.into_iter() {
+        for r in worker_results {
             let _ = r.join();
         }
 
index 9bf0ce1a59099a782f5b6addab025138dc8c4104..1341c03e5055b05e7645f55f2d0ab011786dbf46 100644 (file)
@@ -82,7 +82,7 @@ fn run(args: &[String]) {
             server(&from_parent, &to_parent);
         });
 
-        for r in worker_results.into_iter() {
+        for r in worker_results {
             let _ = r.join();
         }
 
index 4182f8b651b2eaf1fec970b70fa031de789457ce..dc65a63c5cb400c2f3d5271d6aa44093a9c3366a 100644 (file)
@@ -114,7 +114,7 @@ fn main() {
         Thread::scoped(move || inner(depth, iterations))
     }).collect::<Vec<_>>();
 
-    for message in messages.into_iter() {
+    for message in messages {
         println!("{}", message.join().ok().unwrap());
     }
 
index 03666c84d576f71c637961b70a635b53ad587efc..47613e2d69c73c7d5a95637b167daf8e97ce483d 100644 (file)
@@ -171,7 +171,7 @@ fn fannkuch(n: i32) -> (i32, i32) {
 
     let mut checksum = 0;
     let mut maxflips = 0;
-    for fut in futures.into_iter() {
+    for fut in futures {
         let (cs, mf) = fut.join().ok().unwrap();
         checksum += cs;
         maxflips = cmp::max(maxflips, mf);
index a7a47ff07ce44d3dccae16168f2c3b9b4a745076..e3f8e60df93db2fcc7a0901e331abeefa1a7b346 100644 (file)
@@ -308,7 +308,7 @@ fn main() {
         Thread::scoped(move|| generate_frequencies(input.as_slice(), occ.len()))
     }).collect();
 
-    for (i, freq) in nb_freqs.into_iter() {
+    for (i, freq) in nb_freqs {
         print_frequencies(&freq.join().ok().unwrap(), i);
     }
     for (&occ, freq) in OCCURRENCES.iter().zip(occ_freqs.into_iter()) {
index 754b891eb63eff98a3d328a2612bd0dcf21b2ccd..3bd786a3be0627804a79ff4a95f6202ae4d0dde7 100644 (file)
@@ -106,7 +106,7 @@ fn mandelbrot<W: old_io::Writer>(w: uint, mut out: W) -> old_io::IoResult<()> {
         })
     }).collect::<Vec<_>>();
 
-    for res in precalc_futures.into_iter() {
+    for res in precalc_futures {
         let (rs, is) = res.join().ok().unwrap();
         precalc_r.extend(rs.into_iter());
         precalc_i.extend(is.into_iter());
@@ -142,7 +142,7 @@ fn mandelbrot<W: old_io::Writer>(w: uint, mut out: W) -> old_io::IoResult<()> {
     }).collect::<Vec<_>>();
 
     try!(writeln!(&mut out as &mut Writer, "P4\n{} {}", w, h));
-    for res in data.into_iter() {
+    for res in data {
         try!(out.write(res.join().ok().unwrap().as_slice()));
     }
     out.flush()
index dd3ae1699a90230a41334cf28a084229467cb364..ea1d913b3e2ee9cd5f576908c7d507e40ef989e2 100644 (file)
@@ -82,7 +82,7 @@ fn stress(num_tasks: int) {
             stress_task(i);
         }));
     }
-    for r in results.into_iter() {
+    for r in results {
         let _ = r.join();
     }
 }
index 163771a2362bffc0d71cf3d99aa3bd235bee143e..0d526d60190ae1aa75acf9f1ef6403aed733e940 100644 (file)
@@ -215,7 +215,7 @@ fn main() {
       zzz(); // #break
     }
 
-    for simple_tuple_ident in vec![(34903493u32, 232323i64)].into_iter() {
+    for simple_tuple_ident in vec![(34903493u32, 232323i64)] {
       zzz(); // #break
     }
 }
index 4aec3d608acf3963023f558bcae7868d9246b04d..902829468381de01093ec8d74bbe3bfb59451699 100644 (file)
@@ -61,7 +61,7 @@ fn test00() {
     }
 
     // Join spawned tasks...
-    for r in results.into_iter() { r.join(); }
+    for r in results { r.join(); }
 
     println!("Completed: Final number is: ");
     println!("{}", sum);
index e921f0c723ee5a6a1f2d3e2d4d6ba3076bd89cbb..0b85916d224108922dc2b3bd735cf5464def66ce 100644 (file)
@@ -21,7 +21,7 @@ fn main() {
     call(|| {
         // Move `y`, but do not move `counter`, even though it is read
         // by value (note that it is also mutated).
-        for item in y.into_iter() {
+        for item in y {
             let v = counter;
             counter += v;
         }
index 9534ee6fa12619449e6568bc11f46b2847751e92..99663646254e73969c9a22bfeabbb40d26749540 100644 (file)
@@ -22,7 +22,7 @@ fn main() {
         // Here: `x` must be captured with a mutable reference in
         // order for us to append on it, and `y` must be captured by
         // value.
-        for item in y.into_iter() {
+        for item in y {
             x.push(item);
         }
     });