@@ -33,19 +33,17 @@ fn all_ranges<'tcx>(cx: &LateContext<'tcx>, arms: &'tcx [Arm<'_>], ty: Ty<'tcx>)
33
33
. filter_map ( |arm| {
34
34
if let Arm { pat, guard : None , .. } = * arm {
35
35
if let PatKind :: Range ( ref lhs, ref rhs, range_end) = pat. kind {
36
- let lhs_const = match lhs {
37
- Some ( lhs) => constant ( cx, cx. typeck_results ( ) , lhs) ?,
38
- None => {
39
- let min_val_const = ty. numeric_min_val ( cx. tcx ) ?;
40
- mir_to_const ( cx, mir:: Const :: from_ty_const ( min_val_const, ty, cx. tcx ) ) ?
41
- } ,
36
+ let lhs_const = if let Some ( lhs) = lhs {
37
+ constant ( cx, cx. typeck_results ( ) , lhs) ?
38
+ } else {
39
+ let min_val_const = ty. numeric_min_val ( cx. tcx ) ?;
40
+ mir_to_const ( cx, mir:: Const :: from_ty_const ( min_val_const, ty, cx. tcx ) ) ?
42
41
} ;
43
- let rhs_const = match rhs {
44
- Some ( rhs) => constant ( cx, cx. typeck_results ( ) , rhs) ?,
45
- None => {
46
- let max_val_const = ty. numeric_max_val ( cx. tcx ) ?;
47
- mir_to_const ( cx, mir:: Const :: from_ty_const ( max_val_const, ty, cx. tcx ) ) ?
48
- } ,
42
+ let rhs_const = if let Some ( rhs) = rhs {
43
+ constant ( cx, cx. typeck_results ( ) , rhs) ?
44
+ } else {
45
+ let max_val_const = ty. numeric_max_val ( cx. tcx ) ?;
46
+ mir_to_const ( cx, mir:: Const :: from_ty_const ( max_val_const, ty, cx. tcx ) ) ?
49
47
} ;
50
48
let lhs_val = lhs_const. int_value ( cx, ty) ?;
51
49
let rhs_val = rhs_const. int_value ( cx, ty) ?;
0 commit comments