about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-11-11 09:10:30 +0000
committerbors <bors@rust-lang.org>2020-11-11 09:10:30 +0000
commitd4ea0b3e46a0303d5802b632e88ba1ba84d9d16f (patch)
tree052eab1b6fa0810f260cef027039442e5a27fd0d /compiler/rustc_codegen_llvm
parent38030ffb4e735b26260848b744c0910a5641e1db (diff)
parent261ca04c925e1844bbd3525168d129055637e60e (diff)
downloadrust-d4ea0b3e46a0303d5802b632e88ba1ba84d9d16f.tar.gz
rust-d4ea0b3e46a0303d5802b632e88ba1ba84d9d16f.zip
Auto merge of #78825 - Nicholas-Baron:unwrap_or_corrected, r=lcnr
`unwrap_or` lint corrected

https://github.com/rust-lang/rust/issues/78814#issuecomment-723305713

This pull request fixes the lint from clippy where `unwrap_or` could be better done as a `unwrap_or_else` or a `unwrap_or_default`.
Diffstat (limited to 'compiler/rustc_codegen_llvm')
-rw-r--r--compiler/rustc_codegen_llvm/src/intrinsic.rs14
1 files changed, 8 insertions, 6 deletions
diff --git a/compiler/rustc_codegen_llvm/src/intrinsic.rs b/compiler/rustc_codegen_llvm/src/intrinsic.rs
index 4f999f8b560..d52b3be8cd3 100644
--- a/compiler/rustc_codegen_llvm/src/intrinsic.rs
+++ b/compiler/rustc_codegen_llvm/src/intrinsic.rs
@@ -979,12 +979,14 @@ fn generic_simd_intrinsic(
 
         // Integer vector <i{in_bitwidth} x in_len>:
         let (i_xn, in_elem_bitwidth) = match in_elem.kind() {
-            ty::Int(i) => {
-                (args[0].immediate(), i.bit_width().unwrap_or(bx.data_layout().pointer_size.bits()))
-            }
-            ty::Uint(i) => {
-                (args[0].immediate(), i.bit_width().unwrap_or(bx.data_layout().pointer_size.bits()))
-            }
+            ty::Int(i) => (
+                args[0].immediate(),
+                i.bit_width().unwrap_or_else(|| bx.data_layout().pointer_size.bits()),
+            ),
+            ty::Uint(i) => (
+                args[0].immediate(),
+                i.bit_width().unwrap_or_else(|| bx.data_layout().pointer_size.bits()),
+            ),
             _ => return_error!(
                 "vector argument `{}`'s element type `{}`, expected integer element type",
                 in_ty,