diff options
| author | Jubilee <workingjubilee@gmail.com> | 2024-10-28 10:18:52 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-10-28 10:18:52 -0700 |
| commit | 6fd4a76d3bc881c2d98f54f40a9bdcca1c80e446 (patch) | |
| tree | eb3a47904eafe8cb317ae376c594d1d5fb938b8b /compiler/rustc_codegen_llvm/src/llvm_util.rs | |
| parent | bd43f8e9fdda660eb0165c87c270aba189bd5a95 (diff) | |
| parent | 82bfe053095be8f5b159c82b8161e39b351a1043 (diff) | |
| download | rust-6fd4a76d3bc881c2d98f54f40a9bdcca1c80e446.tar.gz rust-6fd4a76d3bc881c2d98f54f40a9bdcca1c80e446.zip | |
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`.
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/llvm_util.rs')
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/llvm_util.rs | 5 |
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) |
