Skip to content

Commit 0c9d42c

Browse files
committed
apply review feedback
1 parent 1f8236d commit 0c9d42c

File tree

2 files changed

+14
-30
lines changed

2 files changed

+14
-30
lines changed

compiler/rustc_target/src/spec/mod.rs

+2-18
Original file line numberDiff line numberDiff line change
@@ -2605,27 +2605,11 @@ impl TargetOptions {
26052605
}
26062606

26072607
pub(crate) fn has_feature(&self, search_feature: &str) -> bool {
2608-
self.features.split(',').any(|f| {
2609-
if let Some(f) = f.strip_prefix('+')
2610-
&& f == search_feature
2611-
{
2612-
true
2613-
} else {
2614-
false
2615-
}
2616-
})
2608+
self.features.split(',').any(|f| f.strip_prefix('+').is_some_and(|f| f == search_feature))
26172609
}
26182610

26192611
pub(crate) fn has_neg_feature(&self, search_feature: &str) -> bool {
2620-
self.features.split(',').any(|f| {
2621-
if let Some(f) = f.strip_prefix('-')
2622-
&& f == search_feature
2623-
{
2624-
true
2625-
} else {
2626-
false
2627-
}
2628-
})
2612+
self.features.split(',').any(|f| f.strip_prefix('-').is_some_and(|f| f == search_feature))
26292613
}
26302614
}
26312615

compiler/rustc_target/src/target_features.rs

+12-12
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,10 @@ impl<Toggleability> Stability<Toggleability> {
105105
/// - for `#[target_feature]`/`-Ctarget-feature`, check `allow_toggle()`
106106
/// - for `cfg(target_feature)`, check `in_cfg`
107107
pub fn requires_nightly(&self) -> Option<Symbol> {
108-
match self {
109-
&Stability::Unstable { nightly_feature, .. } => Some(nightly_feature),
110-
&Stability::Stable { .. } => None,
111-
&Stability::Forbidden { .. } => panic!("forbidden features should not reach this far"),
108+
match *self {
109+
Stability::Unstable { nightly_feature, .. } => Some(nightly_feature),
110+
Stability::Stable { .. } => None,
111+
Stability::Forbidden { .. } => panic!("forbidden features should not reach this far"),
112112
}
113113
}
114114
}
@@ -120,21 +120,21 @@ impl StabilityUncomputed {
120120
enable: f(target, true),
121121
disable: f(target, false),
122122
};
123-
match self {
124-
&Stable { allow_toggle } => Stable { allow_toggle: compute(allow_toggle) },
125-
&Unstable { nightly_feature, allow_toggle } => {
123+
match *self {
124+
Stable { allow_toggle } => Stable { allow_toggle: compute(allow_toggle) },
125+
Unstable { nightly_feature, allow_toggle } => {
126126
Unstable { nightly_feature, allow_toggle: compute(allow_toggle) }
127127
}
128-
&Forbidden { reason } => Forbidden { reason },
128+
Forbidden { reason } => Forbidden { reason },
129129
}
130130
}
131131

132132
pub fn toggle_allowed(&self, target: &Target, enable: bool) -> Result<(), &'static str> {
133133
use Stability::*;
134-
match self {
135-
&Stable { allow_toggle } => allow_toggle(target, enable),
136-
&Unstable { allow_toggle, .. } => allow_toggle(target, enable),
137-
&Forbidden { reason } => Err(reason),
134+
match *self {
135+
Stable { allow_toggle } => allow_toggle(target, enable),
136+
Unstable { allow_toggle, .. } => allow_toggle(target, enable),
137+
Forbidden { reason } => Err(reason),
138138
}
139139
}
140140
}

0 commit comments

Comments
 (0)