about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src/llvm_util.rs
diff options
context:
space:
mode:
authorChrisCho-H <c.hyunhum@gmail.com>2024-10-28 20:16:35 +0900
committerChrisCho-H <c.hyunhum@gmail.com>2024-10-28 20:16:35 +0900
commit82bfe053095be8f5b159c82b8161e39b351a1043 (patch)
tree8c6dda0fdc25ab4cc41191946c6c4fdf521fce6f /compiler/rustc_codegen_llvm/src/llvm_util.rs
parent66701c42263042f7120385725606edeb987ad4f1 (diff)
downloadrust-82bfe053095be8f5b159c82b8161e39b351a1043.tar.gz
rust-82bfe053095be8f5b159c82b8161e39b351a1043.zip
refactor: cleaner check to return None
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/llvm_util.rs')
-rw-r--r--compiler/rustc_codegen_llvm/src/llvm_util.rs5
1 files changed, 1 insertions, 4 deletions
diff --git a/compiler/rustc_codegen_llvm/src/llvm_util.rs b/compiler/rustc_codegen_llvm/src/llvm_util.rs
index aa38c02289d..9adb1299b3d 100644
--- a/compiler/rustc_codegen_llvm/src/llvm_util.rs
+++ b/compiler/rustc_codegen_llvm/src/llvm_util.rs
@@ -698,12 +698,9 @@ fn backend_feature_name<'a>(sess: &Session, s: &'a str) -> Option<&'a str> {
     let feature = s
         .strip_prefix(&['+', '-'][..])
         .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`
     // are not passed down to LLVM.
-    if RUSTC_SPECIFIC_FEATURES.contains(&feature) {
+    if s.is_empty() || RUSTC_SPECIFIC_FEATURES.contains(&feature) {
         return None;
     }
     Some(feature)