Rollup merge of #132261 - ChrisCho-H:refactor/cleaner-check-none, r=compiler-errors
refactor: cleaner check to return None It's very nit change. Refactor to shorten verbose check when returning None for `backend_feature_name`.
This commit is contained in:
commit
6fd4a76d3b
@ -698,12 +698,9 @@ fn backend_feature_name<'a>(sess: &Session, s: &'a str) -> Option<&'a str> {
|
|||||||
let feature = s
|
let feature = s
|
||||||
.strip_prefix(&['+', '-'][..])
|
.strip_prefix(&['+', '-'][..])
|
||||||
.unwrap_or_else(|| sess.dcx().emit_fatal(InvalidTargetFeaturePrefix { feature: s }));
|
.unwrap_or_else(|| sess.dcx().emit_fatal(InvalidTargetFeaturePrefix { feature: s }));
|
||||||
if s.is_empty() {
|
|
||||||
return None;
|
|
||||||
}
|
|
||||||
// Rustc-specific feature requests like `+crt-static` or `-crt-static`
|
// Rustc-specific feature requests like `+crt-static` or `-crt-static`
|
||||||
// are not passed down to LLVM.
|
// are not passed down to LLVM.
|
||||||
if RUSTC_SPECIFIC_FEATURES.contains(&feature) {
|
if s.is_empty() || RUSTC_SPECIFIC_FEATURES.contains(&feature) {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
Some(feature)
|
Some(feature)
|
||||||
|
Loading…
Reference in New Issue
Block a user