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
This commit is contained in:
Alex Crichton 2015-02-02 11:01:12 -08:00
commit 7335c7dd63
319 changed files with 1308 additions and 1443 deletions

View file

@ -425,7 +425,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);
}
@ -435,11 +435,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);
}
}
@ -761,11 +761,11 @@ fn write_out_deps(sess: &Session,
id: &str) {
let mut out_filenames = Vec::new();
for output_type in sess.opts.output_types.iter() {
for output_type in &sess.opts.output_types {
let file = outputs.path(*output_type);
match *output_type {
config::OutputTypeExe => {
for output in sess.crate_types.borrow().iter() {
for output in &*sess.crate_types.borrow() {
let p = link::filename_for_input(sess, *output,
id, &file);
out_filenames.push(p);
@ -801,7 +801,7 @@ fn write_out_deps(sess: &Session,
.map(|fmap| escape_dep_filename(&fmap.name[]))
.collect();
let mut file = try!(old_io::File::create(&deps_filename));
for path in out_filenames.iter() {
for path in &out_filenames {
try!(write!(&mut file as &mut Writer,
"{}: {}\n\n", path.display(), files.connect(" ")));
}

View file

@ -374,7 +374,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);
@ -401,7 +401,7 @@ Available lint options:
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("_", "-"))
@ -436,7 +436,7 @@ Available lint options:
fn describe_debug_flags() {
println!("\nAvailable debug options:\n");
for &(name, _, opt_type_desc, desc) in config::DB_OPTIONS.iter() {
for &(name, _, opt_type_desc, desc) in config::DB_OPTIONS {
let (width, extra) = match opt_type_desc {
Some(..) => (21, "=val"),
None => (25, "")
@ -448,7 +448,7 @@ fn describe_debug_flags() {
fn describe_codegen_flags() {
println!("\nAvailable codegen options:\n");
for &(name, _, opt_type_desc, desc) in config::CG_OPTIONS.iter() {
for &(name, _, opt_type_desc, desc) in config::CG_OPTIONS {
let (width, extra) = match opt_type_desc {
Some(..) => (21, "=val"),
None => (25, "")
@ -543,7 +543,7 @@ fn print_crate_info(sess: &Session,
if sess.opts.prints.len() == 0 { return false }
let attrs = input.map(|input| parse_crate_attrs(sess, input));
for req in sess.opts.prints.iter() {
for req in &sess.opts.prints {
match *req {
PrintRequest::Sysroot => println!("{}", sess.sysroot().display()),
PrintRequest::FileNames |
@ -567,7 +567,7 @@ fn print_crate_info(sess: &Session,
let crate_types = driver::collect_crate_types(sess, attrs);
let metadata = driver::collect_crate_metadata(sess, attrs);
*sess.crate_metadata.borrow_mut() = metadata;
for &style in crate_types.iter() {
for &style in &crate_types {
let fname = link::filename_for_input(sess, style,
id.as_slice(),
&t_outputs.with_extension(""));
@ -646,7 +646,7 @@ pub fn monitor<F:FnOnce()+Send>(f: F) {
BUG_REPORT_URL),
"run with `RUST_BACKTRACE=1` for a backtrace".to_string(),
];
for note in xs.iter() {
for note in &xs {
emitter.emit(None, &note[], None, diagnostic::Note)
}

View file

@ -147,7 +147,7 @@ impl<'a, 'tcx> Env<'a, 'tcx> {
}
pub fn create_region_hierarchy(&self, rh: &RH) {
for child_rh in rh.sub.iter() {
for child_rh in rh.sub {
self.create_region_hierarchy(child_rh);
self.infcx.tcx.region_maps.record_encl_scope(
CodeExtent::from_node_id(child_rh.id),
@ -181,7 +181,7 @@ impl<'a, 'tcx> Env<'a, 'tcx> {
names: &[String])
-> Option<ast::NodeId> {
assert!(idx < names.len());
for item in m.items.iter() {
for item in &m.items {
if item.ident.user_string(this.infcx.tcx) == names[idx] {
return search(this, &**item, idx+1, names);
}