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);
}
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);
}
// 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));
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.
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);
}
assert_eq!(cnt, 8);
- for f in v.into_iter() {
+ for f in v {
assert!(f == Foo);
cnt += 1;
}
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]);
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![(), (), ()]);
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);
// 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]) };
_ => 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");
}
}
// 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");
}
};
- 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();
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[])
}
}
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;
// 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);
}
}
- 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) {
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, " "));
}
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,
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);
}
}
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);
}
// 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);
}
}
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));
}
}
- 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,
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();
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 {
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);
}
{
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);
}
}
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);
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("_", "-"))
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);
}
}
// 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 {
// 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,
}
let mut panicked = false;
- for rx in futures.into_iter() {
+ for rx in futures {
match rx.recv() {
Ok(()) => {},
Err(_) => {
}));
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,
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);
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));
}
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
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);
{
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));
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(
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),
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);
}
});
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);
}
{
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);
}
}
_ => unreachable!()
};
this.sidebar = this.build_sidebar(&m);
- for item in m.items.into_iter() {
+ for item in m.items {
f(this,item);
}
Ok(())
pm.add_plugin(plugin);
}
info!("loading plugins...");
- for pname in plugins.into_iter() {
+ for pname in plugins {
pm.load_plugin(pname);
}
{
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));
}
// 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)),
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
// 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(());
}
}
}
// Wait for children to pass their asserts
- for r in children.into_iter() {
+ for r in children {
assert!(r.join().is_ok());
}
// 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() {
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;
}
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 {
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);
}
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,
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 ?"));
// 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();
}
Err(errors) => {
let n = errors.len();
- for err in errors.into_iter() {
+ for err in errors {
term.err(&format!("error: {}", err)[]);
}
}
}
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>);
server(&from_parent, &to_parent);
});
- for r in worker_results.into_iter() {
+ for r in worker_results {
let _ = r.join();
}
server(&from_parent, &to_parent);
});
- for r in worker_results.into_iter() {
+ for r in worker_results {
let _ = r.join();
}
Thread::scoped(move || inner(depth, iterations))
}).collect::<Vec<_>>();
- for message in messages.into_iter() {
+ for message in messages {
println!("{}", message.join().ok().unwrap());
}
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);
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()) {
})
}).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());
}).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()
stress_task(i);
}));
}
- for r in results.into_iter() {
+ for r in results {
let _ = r.join();
}
}
zzz(); // #break
}
- for simple_tuple_ident in vec![(34903493u32, 232323i64)].into_iter() {
+ for simple_tuple_ident in vec![(34903493u32, 232323i64)] {
zzz(); // #break
}
}
}
// Join spawned tasks...
- for r in results.into_iter() { r.join(); }
+ for r in results { r.join(); }
println!("Completed: Final number is: ");
println!("{}", sum);
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;
}
// 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);
}
});