about summary refs log tree commit diff
path: root/compiler/rustc_passes/src/dead.rs
diff options
context:
space:
mode:
authorCamille GILLOT <gillot.camille@gmail.com>2025-08-04 23:00:45 +0000
committerCamille GILLOT <gillot.camille@gmail.com>2025-08-04 23:00:45 +0000
commite0a89c4b1475b2cd8d7f835e43e79543e262a1ec (patch)
tree7f5ef15fbffa8a818e8700059a1a1dda44bfc6ce /compiler/rustc_passes/src/dead.rs
parenteffc509b40d90a5fe0fa7964cd739b1c887da19f (diff)
downloadrust-e0a89c4b1475b2cd8d7f835e43e79543e262a1ec.tar.gz
rust-e0a89c4b1475b2cd8d7f835e43e79543e262a1ec.zip
Simplify maybe_record_as_seed.
Diffstat (limited to 'compiler/rustc_passes/src/dead.rs')
-rw-r--r--compiler/rustc_passes/src/dead.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/compiler/rustc_passes/src/dead.rs b/compiler/rustc_passes/src/dead.rs
index 88b3f742748..9a163fa6063 100644
--- a/compiler/rustc_passes/src/dead.rs
+++ b/compiler/rustc_passes/src/dead.rs
@@ -745,8 +745,8 @@ fn maybe_record_as_seed<'tcx>(
 
     match tcx.def_kind(owner_id) {
         DefKind::Enum => {
-            let adt = tcx.adt_def(owner_id);
             if let Some(comes_from_allow) = allow_dead_code {
+                let adt = tcx.adt_def(owner_id);
                 worklist.extend(
                     adt.variants()
                         .iter()
@@ -771,8 +771,8 @@ fn maybe_record_as_seed<'tcx>(
                 }
             }
         }
-        DefKind::Impl { of_trait } => {
-            if allow_dead_code.is_none() && of_trait {
+        DefKind::Impl { of_trait: true } => {
+            if allow_dead_code.is_none() {
                 unsolved_items.push(owner_id.def_id);
             }
         }