Skip to content

Commit 2afb92f

Browse files
authored
Rollup merge of #148837 - estebank:let-else, r=Kivooeo
Use `let...else` instead of `match foo { ... _ => return };` and `if let ... else return`
2 parents 8ff1c63 + 824f41e commit 2afb92f

File tree

1 file changed

+15
-16
lines changed

1 file changed

+15
-16
lines changed

src/intrinsic/simd.rs

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -774,24 +774,23 @@ pub fn generic_simd_intrinsic<'a, 'gcc, 'tcx>(
774774
return Err(());
775775
}};
776776
}
777-
let (elem_ty_str, elem_ty, cast_type) = if let ty::Float(ref f) = *in_elem.kind() {
778-
let elem_ty = bx.cx.type_float_from_ty(*f);
779-
match f.bit_width() {
780-
16 => ("", elem_ty, Some(bx.cx.double_type)),
781-
32 => ("f", elem_ty, None),
782-
64 => ("", elem_ty, None),
783-
_ => {
784-
return_error!(InvalidMonomorphization::FloatingPointVector {
785-
span,
786-
name,
787-
f_ty: *f,
788-
in_ty
789-
});
790-
}
791-
}
792-
} else {
777+
let ty::Float(ref f) = *in_elem.kind() else {
793778
return_error!(InvalidMonomorphization::FloatingPointType { span, name, in_ty });
794779
};
780+
let elem_ty = bx.cx.type_float_from_ty(*f);
781+
let (elem_ty_str, elem_ty, cast_type) = match f.bit_width() {
782+
16 => ("", elem_ty, Some(bx.cx.double_type)),
783+
32 => ("f", elem_ty, None),
784+
64 => ("", elem_ty, None),
785+
_ => {
786+
return_error!(InvalidMonomorphization::FloatingPointVector {
787+
span,
788+
name,
789+
f_ty: *f,
790+
in_ty
791+
});
792+
}
793+
};
795794

796795
let vec_ty = bx.cx.type_vector(elem_ty, in_len);
797796

0 commit comments

Comments
 (0)