]> git.lizzy.rs Git - rust.git/blobdiff - compiler/rustc_codegen_ssa/src/base.rs
Rollup merge of #106960 - estebank:parse-anon-enums, r=cjgillot
[rust.git] / compiler / rustc_codegen_ssa / src / base.rs
index f7312f6fcdafdc6d0d90539fa70042a9fbd7f7c8..32d3cfe6fc650a2f76a19e9594bd7870ba5a8eeb 100644 (file)
@@ -964,16 +964,19 @@ pub fn provide(providers: &mut Providers) {
         };
 
         let (defids, _) = tcx.collect_and_partition_mono_items(cratenum);
-        for id in &*defids {
+
+        let any_for_speed = defids.items().any(|id| {
             let CodegenFnAttrs { optimize, .. } = tcx.codegen_fn_attrs(*id);
             match optimize {
-                attr::OptimizeAttr::None => continue,
-                attr::OptimizeAttr::Size => continue,
-                attr::OptimizeAttr::Speed => {
-                    return for_speed;
-                }
+                attr::OptimizeAttr::None | attr::OptimizeAttr::Size => false,
+                attr::OptimizeAttr::Speed => true,
             }
+        });
+
+        if any_for_speed {
+            return for_speed;
         }
+
         tcx.sess.opts.optimize
     };
 }