Skip to content

Commit ce45221

Browse files
committed
simply some valtree-to-const conversion
1 parent 84d6894 commit ce45221

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

clippy_utils/src/lib.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1509,9 +1509,7 @@ pub fn is_range_full(cx: &LateContext<'_>, expr: &Expr<'_>, container_path: Opti
15091509
if let rustc_ty::Adt(_, subst) = ty.kind()
15101510
&& let bnd_ty = subst.type_at(0)
15111511
&& let Some(min_val) = bnd_ty.numeric_min_val(cx.tcx)
1512-
&& let const_val = cx.tcx.valtree_to_const_val((bnd_ty, min_val.to_valtree()))
1513-
&& let min_const_kind = Const::from_value(const_val, bnd_ty)
1514-
&& let Some(min_const) = mir_to_const(cx, min_const_kind)
1512+
&& let Some(min_const) = mir_to_const(cx, Const::from_ty_const(min_val, cx.tcx))
15151513
&& let Some(start_const) = constant(cx, cx.typeck_results(), start)
15161514
{
15171515
start_const == min_const
@@ -1525,9 +1523,7 @@ pub fn is_range_full(cx: &LateContext<'_>, expr: &Expr<'_>, container_path: Opti
15251523
if let rustc_ty::Adt(_, subst) = ty.kind()
15261524
&& let bnd_ty = subst.type_at(0)
15271525
&& let Some(max_val) = bnd_ty.numeric_max_val(cx.tcx)
1528-
&& let const_val = cx.tcx.valtree_to_const_val((bnd_ty, max_val.to_valtree()))
1529-
&& let max_const_kind = Const::from_value(const_val, bnd_ty)
1530-
&& let Some(max_const) = mir_to_const(cx, max_const_kind)
1526+
&& let Some(max_const) = mir_to_const(cx, Const::from_ty_const(max_val, cx.tcx))
15311527
&& let Some(end_const) = constant(cx, cx.typeck_results(), end)
15321528
{
15331529
end_const == max_const

0 commit comments

Comments
 (0)