about summary refs log tree commit diff
path: root/compiler/rustc_metadata
diff options
context:
space:
mode:
authorYotam Ofek <yotam.ofek@gmail.com>2025-03-16 22:23:48 +0000
committerYotam Ofek <yotam.ofek@gmail.com>2025-03-17 09:15:49 +0000
commit51e8309f50ccd5046b0555f394376db59681a38e (patch)
tree82d560f98d9a15533c9beee815a5230cbc10518b /compiler/rustc_metadata
parent227690a258492c84ae9927d18289208d0180e62f (diff)
Flatten and simplify some control flow
Diffstat (limited to 'compiler/rustc_metadata')
-rw-r--r--compiler/rustc_metadata/src/rmeta/encoder.rs5
1 files changed, 2 insertions, 3 deletions
diff --git a/compiler/rustc_metadata/src/rmeta/encoder.rs b/compiler/rustc_metadata/src/rmeta/encoder.rs
index 2b9113242aa..212107edb4d 100644
--- a/compiler/rustc_metadata/src/rmeta/encoder.rs
+++ b/compiler/rustc_metadata/src/rmeta/encoder.rs
@@ -843,9 +843,8 @@ fn analyze_attr(attr: &impl AttributeExt, state: &mut AnalyzeAttrState<'_>) -> b
                 }
             }
         }
-    } else if attr.path().starts_with(&[sym::diagnostic]) && attr.path().len() == 2 {
-        should_encode =
-            rustc_feature::is_stable_diagnostic_attribute(attr.path()[1], state.features);
+    } else if let &[sym::diagnostic, seg] = &*attr.path() {
+        should_encode = rustc_feature::is_stable_diagnostic_attribute(seg, state.features);
     } else {
         should_encode = true;
     }