diff options
| author | Nicholas-Baron <nicholas.baron.ten@gmail.com> | 2020-11-06 13:24:55 -0800 |
|---|---|---|
| committer | Nicholas-Baron <nicholas.baron.ten@gmail.com> | 2020-11-10 20:07:47 -0800 |
| commit | 261ca04c925e1844bbd3525168d129055637e60e (patch) | |
| tree | 052eab1b6fa0810f260cef027039442e5a27fd0d /compiler/rustc_codegen_llvm/src | |
| parent | 38030ffb4e735b26260848b744c0910a5641e1db (diff) | |
| download | rust-261ca04c925e1844bbd3525168d129055637e60e.tar.gz rust-261ca04c925e1844bbd3525168d129055637e60e.zip | |
Changed unwrap_or to unwrap_or_else in some places.
The discussion seems to have resolved that this lint is a bit "noisy" in that applying it in all places would result in a reduction in readability. A few of the trivial functions (like `Path::new`) are fine to leave outside of closures. The general rule seems to be that anything that is obviously an allocation (`Box`, `Vec`, `vec![]`) should be in a closure, even if it is a 0-sized allocation.
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/intrinsic.rs | 14 |
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, |
