about summary refs log tree commit diff
path: root/compiler/rustc_monomorphize/src
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2022-02-03 23:12:25 +0100
committerMatthias Krüger <matthias.krueger@famsik.de>2022-02-03 23:16:03 +0100
commitb80057d08d9f1b1726ec99dc57296cffec246bb1 (patch)
tree07a4034e79abf88324a1bfda5bc2d31fb3cb322b /compiler/rustc_monomorphize/src
parent4e8fb743ccbec27344b2dd42de7057f41d4ebfdd (diff)
downloadrust-b80057d08d9f1b1726ec99dc57296cffec246bb1.tar.gz
rust-b80057d08d9f1b1726ec99dc57296cffec246bb1.zip
compiler: clippy::complexity fixes
useless_format
map_flatten
useless_conversion
needless_bool
filter_next
clone_on_copy
needless_option_as_deref
Diffstat (limited to 'compiler/rustc_monomorphize/src')
-rw-r--r--compiler/rustc_monomorphize/src/partitioning/mod.rs22
1 files changed, 10 insertions, 12 deletions
diff --git a/compiler/rustc_monomorphize/src/partitioning/mod.rs b/compiler/rustc_monomorphize/src/partitioning/mod.rs
index 67597a0d7b4..b8684a09fd7 100644
--- a/compiler/rustc_monomorphize/src/partitioning/mod.rs
+++ b/compiler/rustc_monomorphize/src/partitioning/mod.rs
@@ -220,18 +220,16 @@ pub fn partition<'tcx>(
         let mut cgus: Vec<_> = post_inlining.codegen_units.iter_mut().collect();
         cgus.sort_by_key(|cgu| cgu.size_estimate());
 
-        let dead_code_cgu = if let Some(cgu) = cgus
-            .into_iter()
-            .rev()
-            .filter(|cgu| cgu.items().iter().any(|(_, (linkage, _))| *linkage == Linkage::External))
-            .next()
-        {
-            cgu
-        } else {
-            // If there are no CGUs that have externally linked items,
-            // then we just pick the first CGU as a fallback.
-            &mut post_inlining.codegen_units[0]
-        };
+        let dead_code_cgu =
+            if let Some(cgu) = cgus.into_iter().rev().find(|cgu| {
+                cgu.items().iter().any(|(_, (linkage, _))| *linkage == Linkage::External)
+            }) {
+                cgu
+            } else {
+                // If there are no CGUs that have externally linked items,
+                // then we just pick the first CGU as a fallback.
+                &mut post_inlining.codegen_units[0]
+            };
         dead_code_cgu.make_code_coverage_dead_code_cgu();
     }