Skip to content

Commit 5cd391c

Browse files
committed
make the set of methods between our two Const types more consistent
1 parent b643f20 commit 5cd391c

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

clippy_lints/src/matches/overlapping_arms.rs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,22 +37,14 @@ fn all_ranges<'tcx>(cx: &LateContext<'tcx>, arms: &'tcx [Arm<'_>], ty: Ty<'tcx>)
3737
Some(lhs) => constant(cx, cx.typeck_results(), lhs)?,
3838
None => {
3939
let min_val_const = ty.numeric_min_val(cx.tcx)?;
40-
let min_constant = mir::ConstantKind::from_value(
41-
cx.tcx.valtree_to_const_val((ty, min_val_const.to_valtree())),
42-
ty,
43-
);
44-
miri_to_const(cx, min_constant)?
40+
miri_to_const(cx, mir::ConstantKind::from_ty_const(min_val_const, cx.tcx))?
4541
},
4642
};
4743
let rhs_const = match rhs {
4844
Some(rhs) => constant(cx, cx.typeck_results(), rhs)?,
4945
None => {
5046
let max_val_const = ty.numeric_max_val(cx.tcx)?;
51-
let max_constant = mir::ConstantKind::from_value(
52-
cx.tcx.valtree_to_const_val((ty, max_val_const.to_valtree())),
53-
ty,
54-
);
55-
miri_to_const(cx, max_constant)?
47+
miri_to_const(cx, mir::ConstantKind::from_ty_const(max_val_const, cx.tcx))?
5648
},
5749
};
5850
let lhs_val = lhs_const.int_value(cx, ty)?;

0 commit comments

Comments
 (0)