about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSantiago Pastorino <spastorino@gmail.com>2019-12-11 01:57:01 -0300
committerOliver Scherer <github35764891676564198441@oli-obk.de>2020-01-10 09:08:24 +0100
commitfb2f0ec416167d9d7a454c6eff6601fb7a009e9e (patch)
tree8c4eb79431dd0d64a95dc9f42e6470beb49ed277
parentb63597dedba1c94a1fa9f2521ce50723cc019e78 (diff)
downloadrust-fb2f0ec416167d9d7a454c6eff6601fb7a009e9e.tar.gz
rust-fb2f0ec416167d9d7a454c6eff6601fb7a009e9e.zip
Use if let instead of match with one meaningful arm
-rw-r--r--src/librustc_codegen_ssa/mir/block.rs28
1 files changed, 9 insertions, 19 deletions
diff --git a/src/librustc_codegen_ssa/mir/block.rs b/src/librustc_codegen_ssa/mir/block.rs
index ecb3eb05f11..a1ff62fde0a 100644
--- a/src/librustc_codegen_ssa/mir/block.rs
+++ b/src/librustc_codegen_ssa/mir/block.rs
@@ -609,25 +609,15 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
                     // checked by const-qualification, which also
                     // promotes any complex rvalues to constants.
                     if i == 2 && intrinsic.unwrap().starts_with("simd_shuffle") {
-                        match arg {
-                            // The shuffle array argument is usually not an explicit constant,
-                            // but specified directly in the code. This means it gets promoted
-                            // and we can then extract the value by evaluating the promoted.
-                            mir::Operand::Copy(_place) | mir::Operand::Move(_place) => {}
-
-                            mir::Operand::Constant(constant) => {
-                                let c = self.eval_mir_constant(constant);
-                                let (llval, ty) = self.simd_shuffle_indices(
-                                    &bx,
-                                    constant.span,
-                                    constant.literal.ty,
-                                    c,
-                                );
-                                return OperandRef {
-                                    val: Immediate(llval),
-                                    layout: bx.layout_of(ty),
-                                };
-                            }
+                        if let mir::Operand::Constant(constant) = arg {
+                            let c = self.eval_mir_constant(constant);
+                            let (llval, ty) = self.simd_shuffle_indices(
+                                &bx,
+                                constant.span,
+                                constant.literal.ty,
+                                c,
+                            );
+                            return OperandRef { val: Immediate(llval), layout: bx.layout_of(ty) };
                         }
                     }