about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm
diff options
context:
space:
mode:
authorLingMan <LingMan@users.noreply.github.com>2021-01-16 20:13:06 +0100
committerLingMan <LingMan@users.noreply.github.com>2021-01-16 20:13:06 +0100
commit5a706cfc49295f67c01fd3d422fa6fa69a018d92 (patch)
treed1174cc3ff0ba7a08ba63833abf018a19c81f4d1 /compiler/rustc_codegen_llvm
parentefdb859dcdf7077cf6b8c85af0ea8820c93bcbdf (diff)
downloadrust-5a706cfc49295f67c01fd3d422fa6fa69a018d92.tar.gz
rust-5a706cfc49295f67c01fd3d422fa6fa69a018d92.zip
Use Option::unwrap_or instead of open-coding it
Diffstat (limited to 'compiler/rustc_codegen_llvm')
-rw-r--r--compiler/rustc_codegen_llvm/src/llvm_util.rs6
1 files changed, 1 insertions, 5 deletions
diff --git a/compiler/rustc_codegen_llvm/src/llvm_util.rs b/compiler/rustc_codegen_llvm/src/llvm_util.rs
index 6c2a871e520..722af496422 100644
--- a/compiler/rustc_codegen_llvm/src/llvm_util.rs
+++ b/compiler/rustc_codegen_llvm/src/llvm_util.rs
@@ -214,11 +214,7 @@ fn handle_native(name: &str) -> &str {
 }
 
 pub fn target_cpu(sess: &Session) -> &str {
-    let name = match sess.opts.cg.target_cpu {
-        Some(ref s) => &**s,
-        None => &*sess.target.cpu,
-    };
-
+    let name = sess.opts.cg.target_cpu.as_ref().unwrap_or(&sess.target.cpu);
     handle_native(name)
 }