Skip to content

Commit fb2f0ec

Browse files
spastorinooli-obk
authored andcommitted
Use if let instead of match with one meaningful arm
1 parent b63597d commit fb2f0ec

File tree

1 file changed

+9
-19
lines changed

1 file changed

+9
-19
lines changed

src/librustc_codegen_ssa/mir/block.rs

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -609,25 +609,15 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
609609
// checked by const-qualification, which also
610610
// promotes any complex rvalues to constants.
611611
if i == 2 && intrinsic.unwrap().starts_with("simd_shuffle") {
612-
match arg {
613-
// The shuffle array argument is usually not an explicit constant,
614-
// but specified directly in the code. This means it gets promoted
615-
// and we can then extract the value by evaluating the promoted.
616-
mir::Operand::Copy(_place) | mir::Operand::Move(_place) => {}
617-
618-
mir::Operand::Constant(constant) => {
619-
let c = self.eval_mir_constant(constant);
620-
let (llval, ty) = self.simd_shuffle_indices(
621-
&bx,
622-
constant.span,
623-
constant.literal.ty,
624-
c,
625-
);
626-
return OperandRef {
627-
val: Immediate(llval),
628-
layout: bx.layout_of(ty),
629-
};
630-
}
612+
if let mir::Operand::Constant(constant) = arg {
613+
let c = self.eval_mir_constant(constant);
614+
let (llval, ty) = self.simd_shuffle_indices(
615+
&bx,
616+
constant.span,
617+
constant.literal.ty,
618+
c,
619+
);
620+
return OperandRef { val: Immediate(llval), layout: bx.layout_of(ty) };
631621
}
632622
}
633623

0 commit comments

Comments
 (0)