diff --git a/src/compiletest/procsrv.rs b/src/compiletest/procsrv.rs index 57f4171f7c2..4b0eea33d69 100644 --- a/src/compiletest/procsrv.rs +++ b/src/compiletest/procsrv.rs @@ -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); } diff --git a/src/compiletest/runtest.rs b/src/compiletest/runtest.rs index 2143cf22e05..3022973d9c1 100644 --- a/src/compiletest/runtest.rs +++ b/src/compiletest/runtest.rs @@ -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)); diff --git a/src/libcollections/btree/map.rs b/src/libcollections/btree/map.rs index bc657a19d78..23eab79e6a4 100644 --- a/src/libcollections/btree/map.rs +++ b/src/libcollections/btree/map.rs @@ -197,7 +197,7 @@ impl BTreeMap { 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. diff --git a/src/libcollections/dlist.rs b/src/libcollections/dlist.rs index e229cd8a961..c6c8a6e4a1e 100644 --- a/src/libcollections/dlist.rs +++ b/src/libcollections/dlist.rs @@ -1061,7 +1061,7 @@ mod tests { 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); diff --git a/src/libcollections/slice.rs b/src/libcollections/slice.rs index 3830ab9ee7b..4b4ea3e4c3c 100644 --- a/src/libcollections/slice.rs +++ b/src/libcollections/slice.rs @@ -2699,7 +2699,7 @@ mod tests { } assert_eq!(cnt, 8); - for f in v.into_iter() { + for f in v { assert!(f == Foo); cnt += 1; } diff --git a/src/libcollections/vec.rs b/src/libcollections/vec.rs index acf4b480dfb..22b0e0f7cc9 100644 --- a/src/libcollections/vec.rs +++ b/src/libcollections/vec.rs @@ -2333,7 +2333,7 @@ mod tests { fn test_move_items() { let vec = vec![1, 2, 3]; let mut vec2 : Vec = vec![]; - for i in vec.into_iter() { + for i in vec { vec2.push(i); } assert!(vec2 == vec![1, 2, 3]); @@ -2353,7 +2353,7 @@ mod tests { 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![(), (), ()]); diff --git a/src/libcollections/vec_map.rs b/src/libcollections/vec_map.rs index b07e172079e..e480d29541e 100644 --- a/src/libcollections/vec_map.rs +++ b/src/libcollections/vec_map.rs @@ -984,7 +984,7 @@ mod test_map { 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); diff --git a/src/libcore/fmt/mod.rs b/src/libcore/fmt/mod.rs index 20ef30b0a3e..ead49af18d0 100644 --- a/src/libcore/fmt/mod.rs +++ b/src/libcore/fmt/mod.rs @@ -482,7 +482,7 @@ impl<'a> Formatter<'a> { // 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]) }; diff --git a/src/librustc/lint/context.rs b/src/librustc/lint/context.rs index 2bc29e61d0d..91dba90b0d2 100644 --- a/src/librustc/lint/context.rs +++ b/src/librustc/lint/context.rs @@ -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(¬e[]); } - for span in def.into_iter() { + if let Some(span) = def { sess.span_note(span, "lint level defined here"); } } @@ -492,7 +492,7 @@ impl<'a, 'tcx> Context<'a, 'tcx> { // 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 @@ impl<'a, 'tcx> Context<'a, 'tcx> { } }; - 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 @@ impl<'a, 'tcx> IdVisitingOperation for Context<'a, 'tcx> { 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[]) } } diff --git a/src/librustc/metadata/encoder.rs b/src/librustc/metadata/encoder.rs index 117ab4c8a5a..ccd524a2c03 100644 --- a/src/librustc/metadata/encoder.rs +++ b/src/librustc/metadata/encoder.rs @@ -1589,7 +1589,7 @@ fn encode_index(rbml_w: &mut Encoder, index: Vec>, mut write_fn: T: Hash, { let mut buckets: Vec>> = (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; diff --git a/src/librustc/metadata/loader.rs b/src/librustc/metadata/loader.rs index f219bfffcb8..30b783cd509 100644 --- a/src/librustc/metadata/loader.rs +++ b/src/librustc/metadata/loader.rs @@ -425,7 +425,7 @@ impl<'a> Context<'a> { // 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 @@ impl<'a> Context<'a> { } } - 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) { diff --git a/src/librustc/middle/check_match.rs b/src/librustc/middle/check_match.rs index 72551daa4e6..38084d1c2c0 100644 --- a/src/librustc/middle/check_match.rs +++ b/src/librustc/middle/check_match.rs @@ -77,7 +77,7 @@ impl<'a> fmt::Debug for Matrix<'a> { let total_width = column_widths.iter().map(|n| *n).sum() + column_count * 3 + 1; let br = repeat('+').take(total_width).collect::(); 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, " ")); diff --git a/src/librustc/middle/dead.rs b/src/librustc/middle/dead.rs index 6bad7f59441..4478e327087 100644 --- a/src/librustc/middle/dead.rs +++ b/src/librustc/middle/dead.rs @@ -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, diff --git a/src/librustc/middle/subst.rs b/src/librustc/middle/subst.rs index 2cf8a83db9b..43319540c4e 100644 --- a/src/librustc/middle/subst.rs +++ b/src/librustc/middle/subst.rs @@ -352,7 +352,7 @@ impl VecPerParamSpace { pub fn replace(&mut self, space: ParamSpace, elems: Vec) { // 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); } } diff --git a/src/librustc/middle/traits/fulfill.rs b/src/librustc/middle/traits/fulfill.rs index ed058280483..8adcd256cce 100644 --- a/src/librustc/middle/traits/fulfill.rs +++ b/src/librustc/middle/traits/fulfill.rs @@ -125,7 +125,7 @@ impl<'tcx> FulfillmentContext<'tcx> { 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 @@ impl<'tcx> FulfillmentContext<'tcx> { // 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); } } diff --git a/src/librustc/middle/traits/mod.rs b/src/librustc/middle/traits/mod.rs index 94da688181e..f69bf31626f 100644 --- a/src/librustc/middle/traits/mod.rs +++ b/src/librustc/middle/traits/mod.rs @@ -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, ¶m_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)); diff --git a/src/librustc/plugin/load.rs b/src/librustc/plugin/load.rs index 22edd7c691a..b9bf577b38e 100644 --- a/src/librustc/plugin/load.rs +++ b/src/librustc/plugin/load.rs @@ -204,7 +204,7 @@ impl<'a> PluginLoader<'a> { } } - 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, diff --git a/src/librustc/session/config.rs b/src/librustc/session/config.rs index afeb123b7a5..88f6dc673cf 100644 --- a/src/librustc/session/config.rs +++ b/src/librustc/session/config.rs @@ -300,7 +300,7 @@ macro_rules! options { 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 { diff --git a/src/librustc_driver/driver.rs b/src/librustc_driver/driver.rs index e8ea349c3db..8d73532cf52 100644 --- a/src/librustc_driver/driver.rs +++ b/src/librustc_driver/driver.rs @@ -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); } } diff --git a/src/librustc_driver/lib.rs b/src/librustc_driver/lib.rs index a8f5cfa6b3f..794d66e66ab 100644 --- a/src/librustc_driver/lib.rs +++ b/src/librustc_driver/lib.rs @@ -373,7 +373,7 @@ Available lint options: 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 @@ Available lint options: println!(" {} {}", padded("----"), "---------"); let print_lint_groups = |&: lints: Vec<(&'static str, Vec)>| { - for (name, to) in lints.into_iter() { + for (name, to) in lints { let name = name.chars().map(|x| x.to_lowercase()) .collect::().replace("_", "-"); let desc = to.into_iter().map(|x| x.as_str().replace("_", "-")) diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs index c10b7124218..a5fb57eadc4 100644 --- a/src/librustc_resolve/lib.rs +++ b/src/librustc_resolve/lib.rs @@ -3607,10 +3607,10 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { 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); } } diff --git a/src/librustc_trans/back/link.rs b/src/librustc_trans/back/link.rs index eeb6d9fab5e..145cf46ad9d 100644 --- a/src/librustc_trans/back/link.rs +++ b/src/librustc_trans/back/link.rs @@ -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 { diff --git a/src/librustc_trans/back/lto.rs b/src/librustc_trans/back/lto.rs index 1a5310bb0a8..38c68bc9fa4 100644 --- a/src/librustc_trans/back/lto.rs +++ b/src/librustc_trans/back/lto.rs @@ -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, diff --git a/src/librustc_trans/back/write.rs b/src/librustc_trans/back/write.rs index c54e3e02d3c..5312d2ca1dd 100644 --- a/src/librustc_trans/back/write.rs +++ b/src/librustc_trans/back/write.rs @@ -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(_) => { diff --git a/src/librustc_trans/trans/callee.rs b/src/librustc_trans/trans/callee.rs index 5f3cb01d762..5f383d54a68 100644 --- a/src/librustc_trans/trans/callee.rs +++ b/src/librustc_trans/trans/callee.rs @@ -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, diff --git a/src/librustc_trans/trans/monomorphize.rs b/src/librustc_trans/trans/monomorphize.rs index cc0d76efcf0..b3d388b0f02 100644 --- a/src/librustc_trans/trans/monomorphize.rs +++ b/src/librustc_trans/trans/monomorphize.rs @@ -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); diff --git a/src/librustc_typeck/astconv.rs b/src/librustc_typeck/astconv.rs index 3bf34dfcd70..8809931cd80 100644 --- a/src/librustc_typeck/astconv.rs +++ b/src/librustc_typeck/astconv.rs @@ -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)); } diff --git a/src/librustc_typeck/check/assoc.rs b/src/librustc_typeck/check/assoc.rs index 0e0a9294640..377af080526 100644 --- a/src/librustc_typeck/check/assoc.rs +++ b/src/librustc_typeck/check/assoc.rs @@ -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 diff --git a/src/librustc_typeck/check/compare_method.rs b/src/librustc_typeck/check/compare_method.rs index 31b14ea3f3d..dc4d7d46647 100644 --- a/src/librustc_typeck/check/compare_method.rs +++ b/src/librustc_typeck/check/compare_method.rs @@ -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); diff --git a/src/librustc_typeck/check/method/probe.rs b/src/librustc_typeck/check/method/probe.rs index 8ad67b43178..a988fb4cc6e 100644 --- a/src/librustc_typeck/check/method/probe.rs +++ b/src/librustc_typeck/check/method/probe.rs @@ -448,7 +448,7 @@ impl<'a,'tcx> ProbeContext<'a,'tcx> { { 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)); diff --git a/src/librustc_typeck/check/vtable.rs b/src/librustc_typeck/check/vtable.rs index 43910a937e8..6f66010925e 100644 --- a/src/librustc_typeck/check/vtable.rs +++ b/src/librustc_typeck/check/vtable.rs @@ -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), diff --git a/src/librustc_typeck/check/wf.rs b/src/librustc_typeck/check/wf.rs index 24153fd94ea..71b495af444 100644 --- a/src/librustc_typeck/check/wf.rs +++ b/src/librustc_typeck/check/wf.rs @@ -268,10 +268,10 @@ impl<'ccx, 'tcx> CheckTypeWellFormedVisitor<'ccx, 'tcx> { 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); } }); diff --git a/src/librustc_typeck/collect.rs b/src/librustc_typeck/collect.rs index 6d92343d332..4114e92a096 100644 --- a/src/librustc_typeck/collect.rs +++ b/src/librustc_typeck/collect.rs @@ -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 ty_generics<'a,'tcx>(ccx: &CollectCtxt<'a,'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); } } diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index 80e72777f93..6247c6dad14 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -1231,7 +1231,7 @@ impl Context { _ => unreachable!() }; this.sidebar = this.build_sidebar(&m); - for item in m.items.into_iter() { + for item in m.items { f(this,item); } Ok(()) diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index 9efd7cfb2e2..531e798a59f 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -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); } diff --git a/src/libserialize/json.rs b/src/libserialize/json.rs index f43f22ec57c..3bc9e699035 100644 --- a/src/libserialize/json.rs +++ b/src/libserialize/json.rs @@ -2371,7 +2371,7 @@ impl ::Decoder for Decoder { { 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)); } diff --git a/src/libstd/old_io/fs.rs b/src/libstd/old_io/fs.rs index 142f723ef71..e1006f23996 100644 --- a/src/libstd/old_io/fs.rs +++ b/src/libstd/old_io/fs.rs @@ -649,7 +649,7 @@ pub fn rmdir_recursive(path: &Path) -> IoResult<()> { // 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)), diff --git a/src/libstd/old_io/net/mod.rs b/src/libstd/old_io/net/mod.rs index d8394aa8b6a..bbe3a71dcc0 100644 --- a/src/libstd/old_io/net/mod.rs +++ b/src/libstd/old_io/net/mod.rs @@ -36,7 +36,7 @@ fn with_addresses(addr: A, mut action: F) -> IoResult 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 diff --git a/src/libstd/rt/at_exit_imp.rs b/src/libstd/rt/at_exit_imp.rs index 5823f8453d8..3f15cf71ec3 100644 --- a/src/libstd/rt/at_exit_imp.rs +++ b/src/libstd/rt/at_exit_imp.rs @@ -58,7 +58,7 @@ pub fn cleanup() { // If we never called init, not need to cleanup! if queue as uint != 0 { let queue: Box = mem::transmute(queue); - for to_run in queue.into_iter() { + for to_run in *queue { to_run.invoke(()); } } diff --git a/src/libstd/sync/rwlock.rs b/src/libstd/sync/rwlock.rs index 95b570dd9c8..2dfc708e15b 100644 --- a/src/libstd/sync/rwlock.rs +++ b/src/libstd/sync/rwlock.rs @@ -508,7 +508,7 @@ mod tests { } // Wait for children to pass their asserts - for r in children.into_iter() { + for r in children { assert!(r.join().is_ok()); } diff --git a/src/libstd/sys/windows/process.rs b/src/libstd/sys/windows/process.rs index a0a0c08ed09..58797111a20 100644 --- a/src/libstd/sys/windows/process.rs +++ b/src/libstd/sys/windows/process.rs @@ -147,7 +147,7 @@ impl Process { // 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() { diff --git a/src/libsyntax/attr.rs b/src/libsyntax/attr.rs index 61ddd240abc..e5cd6f63690 100644 --- a/src/libsyntax/attr.rs +++ b/src/libsyntax/attr.rs @@ -490,7 +490,7 @@ fn find_stability_generic<'a, pub fn find_stability(diagnostic: &SpanHandler, attrs: &[Attribute], item_sp: Span) -> Option { 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; } 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/expand.rs b/src/libsyntax/ext/expand.rs index 8b4816f5d2b..2787339aac0 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -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/parse/parser.rs b/src/libsyntax/parse/parser.rs index b7960d9e709..27fd803d3fe 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -5445,7 +5445,7 @@ impl<'a> Parser<'a> { 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, diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index 21cd02b3851..5c42485f239 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -966,7 +966,7 @@ impl<'a> State<'a> { 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 ?")); diff --git a/src/libtest/lib.rs b/src/libtest/lib.rs index 63969e996d3..25377e3afa1 100644 --- a/src/libtest/lib.rs +++ b/src/libtest/lib.rs @@ -806,7 +806,7 @@ fn run_tests(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(); diff --git a/src/rustbook/build.rs b/src/rustbook/build.rs index ccb572a113a..3c9c4bdedcc 100644 --- a/src/rustbook/build.rs +++ b/src/rustbook/build.rs @@ -177,7 +177,7 @@ impl Subcommand for Build { } Err(errors) => { let n = errors.len(); - for err in errors.into_iter() { + for err in errors { term.err(&format!("error: {}", err)[]); } diff --git a/src/rustbook/test.rs b/src/rustbook/test.rs index db02481cb02..d3cb8a7316e 100644 --- a/src/rustbook/test.rs +++ b/src/rustbook/test.rs @@ -64,7 +64,7 @@ impl Subcommand for Test { } } Err(errors) => { - for err in errors.into_iter() { + for err in errors { term.err(&err[]); } return Err(box "There was an error." as Box); diff --git a/src/test/bench/msgsend-pipes-shared.rs b/src/test/bench/msgsend-pipes-shared.rs index 6928397566d..259b4d9418d 100644 --- a/src/test/bench/msgsend-pipes-shared.rs +++ b/src/test/bench/msgsend-pipes-shared.rs @@ -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(); } diff --git a/src/test/bench/msgsend-pipes.rs b/src/test/bench/msgsend-pipes.rs index 9bf0ce1a590..1341c03e505 100644 --- a/src/test/bench/msgsend-pipes.rs +++ b/src/test/bench/msgsend-pipes.rs @@ -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(); } diff --git a/src/test/bench/shootout-binarytrees.rs b/src/test/bench/shootout-binarytrees.rs index 4182f8b651b..dc65a63c5cb 100644 --- a/src/test/bench/shootout-binarytrees.rs +++ b/src/test/bench/shootout-binarytrees.rs @@ -114,7 +114,7 @@ fn main() { Thread::scoped(move || inner(depth, iterations)) }).collect::>(); - for message in messages.into_iter() { + for message in messages { println!("{}", message.join().ok().unwrap()); } diff --git a/src/test/bench/shootout-fannkuch-redux.rs b/src/test/bench/shootout-fannkuch-redux.rs index 03666c84d57..47613e2d69c 100644 --- a/src/test/bench/shootout-fannkuch-redux.rs +++ b/src/test/bench/shootout-fannkuch-redux.rs @@ -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); diff --git a/src/test/bench/shootout-k-nucleotide.rs b/src/test/bench/shootout-k-nucleotide.rs index a7a47ff07ce..e3f8e60df93 100644 --- a/src/test/bench/shootout-k-nucleotide.rs +++ b/src/test/bench/shootout-k-nucleotide.rs @@ -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()) { diff --git a/src/test/bench/shootout-mandelbrot.rs b/src/test/bench/shootout-mandelbrot.rs index 754b891eb63..3bd786a3be0 100644 --- a/src/test/bench/shootout-mandelbrot.rs +++ b/src/test/bench/shootout-mandelbrot.rs @@ -106,7 +106,7 @@ fn mandelbrot(w: uint, mut out: W) -> old_io::IoResult<()> { }) }).collect::>(); - 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: uint, mut out: W) -> old_io::IoResult<()> { }).collect::>(); 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() diff --git a/src/test/bench/shootout-pfib.rs b/src/test/bench/shootout-pfib.rs index dd3ae1699a9..ea1d913b3e2 100644 --- a/src/test/bench/shootout-pfib.rs +++ b/src/test/bench/shootout-pfib.rs @@ -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(); } } diff --git a/src/test/debuginfo/destructured-for-loop-variable.rs b/src/test/debuginfo/destructured-for-loop-variable.rs index 163771a2362..0d526d60190 100644 --- a/src/test/debuginfo/destructured-for-loop-variable.rs +++ b/src/test/debuginfo/destructured-for-loop-variable.rs @@ -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 } } diff --git a/src/test/run-pass/task-comm-3.rs b/src/test/run-pass/task-comm-3.rs index 4aec3d608ac..90282946838 100644 --- a/src/test/run-pass/task-comm-3.rs +++ b/src/test/run-pass/task-comm-3.rs @@ -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); diff --git a/src/test/run-pass/unboxed-closures-counter-not-moved.rs b/src/test/run-pass/unboxed-closures-counter-not-moved.rs index e921f0c723e..0b85916d224 100644 --- a/src/test/run-pass/unboxed-closures-counter-not-moved.rs +++ b/src/test/run-pass/unboxed-closures-counter-not-moved.rs @@ -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; } diff --git a/src/test/run-pass/unboxed-closures-move-some-upvars-in-by-ref-closure.rs b/src/test/run-pass/unboxed-closures-move-some-upvars-in-by-ref-closure.rs index 9534ee6fa12..99663646254 100644 --- a/src/test/run-pass/unboxed-closures-move-some-upvars-in-by-ref-closure.rs +++ b/src/test/run-pass/unboxed-closures-move-some-upvars-in-by-ref-closure.rs @@ -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); } });