]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_driver/lib.rs
rollup merge of #21830: japaric/for-cleanup
[rust.git] / src / librustc_driver / lib.rs
index 6230f0b14a23b8672c59fa0d560b1dd7d6d62e33..d71e85e6a55c60a918c210e4cbe483d1bbe7c743 100644 (file)
@@ -374,7 +374,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);
@@ -401,7 +401,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("_", "-"))
@@ -436,7 +436,7 @@ fn sort_lint_groups(lints: Vec<(&'static str, Vec<lint::LintId>, bool)>)
 
 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)
                 }