about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--compiler/rustc_target/src/spec/mod.rs20
-rw-r--r--compiler/rustc_target/src/target_features.rs24
2 files changed, 14 insertions, 30 deletions
diff --git a/compiler/rustc_target/src/spec/mod.rs b/compiler/rustc_target/src/spec/mod.rs
index 06d2099a446..f7cf12215f3 100644
--- a/compiler/rustc_target/src/spec/mod.rs
+++ b/compiler/rustc_target/src/spec/mod.rs
@@ -2605,27 +2605,11 @@ impl TargetOptions {
     }
 
     pub(crate) fn has_feature(&self, search_feature: &str) -> bool {
-        self.features.split(',').any(|f| {
-            if let Some(f) = f.strip_prefix('+')
-                && f == search_feature
-            {
-                true
-            } else {
-                false
-            }
-        })
+        self.features.split(',').any(|f| f.strip_prefix('+').is_some_and(|f| f == search_feature))
     }
 
     pub(crate) fn has_neg_feature(&self, search_feature: &str) -> bool {
-        self.features.split(',').any(|f| {
-            if let Some(f) = f.strip_prefix('-')
-                && f == search_feature
-            {
-                true
-            } else {
-                false
-            }
-        })
+        self.features.split(',').any(|f| f.strip_prefix('-').is_some_and(|f| f == search_feature))
     }
 }
 
diff --git a/compiler/rustc_target/src/target_features.rs b/compiler/rustc_target/src/target_features.rs
index e1f7884610c..713b5dc70d7 100644
--- a/compiler/rustc_target/src/target_features.rs
+++ b/compiler/rustc_target/src/target_features.rs
@@ -105,10 +105,10 @@ impl<Toggleability> Stability<Toggleability> {
     /// - for `#[target_feature]`/`-Ctarget-feature`, check `allow_toggle()`
     /// - for `cfg(target_feature)`, check `in_cfg`
     pub fn requires_nightly(&self) -> Option<Symbol> {
-        match self {
-            &Stability::Unstable { nightly_feature, .. } => Some(nightly_feature),
-            &Stability::Stable { .. } => None,
-            &Stability::Forbidden { .. } => panic!("forbidden features should not reach this far"),
+        match *self {
+            Stability::Unstable { nightly_feature, .. } => Some(nightly_feature),
+            Stability::Stable { .. } => None,
+            Stability::Forbidden { .. } => panic!("forbidden features should not reach this far"),
         }
     }
 }
@@ -120,21 +120,21 @@ impl StabilityUncomputed {
             enable: f(target, true),
             disable: f(target, false),
         };
-        match self {
-            &Stable { allow_toggle } => Stable { allow_toggle: compute(allow_toggle) },
-            &Unstable { nightly_feature, allow_toggle } => {
+        match *self {
+            Stable { allow_toggle } => Stable { allow_toggle: compute(allow_toggle) },
+            Unstable { nightly_feature, allow_toggle } => {
                 Unstable { nightly_feature, allow_toggle: compute(allow_toggle) }
             }
-            &Forbidden { reason } => Forbidden { reason },
+            Forbidden { reason } => Forbidden { reason },
         }
     }
 
     pub fn toggle_allowed(&self, target: &Target, enable: bool) -> Result<(), &'static str> {
         use Stability::*;
-        match self {
-            &Stable { allow_toggle } => allow_toggle(target, enable),
-            &Unstable { allow_toggle, .. } => allow_toggle(target, enable),
-            &Forbidden { reason } => Err(reason),
+        match *self {
+            Stable { allow_toggle } => allow_toggle(target, enable),
+            Unstable { allow_toggle, .. } => allow_toggle(target, enable),
+            Forbidden { reason } => Err(reason),
         }
     }
 }