1
Fork 0

Simplify calls to tcx.mk_const

`mk_const(ty::ConstKind::X(...), ty)` can now be simplified to
`mk_cosnt(...,                   ty)`.

I searched with the following regex: \mk_const\([\n\s]*(ty::)?ConstKind\
I've left `ty::ConstKind::{Bound, Error}` as-is, they seem clearer this
way.
This commit is contained in:
Maybe Waffle 2022-11-28 12:28:32 +00:00
parent 7087d9b2a0
commit 26b87bf8ff
10 changed files with 27 additions and 46 deletions

View file

@ -77,7 +77,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
Constant { user_ty, span, literal }
}
ExprKind::ConstParam { param, def_id: _ } => {
let const_param = tcx.mk_const(ty::ConstKind::Param(param), expr.ty);
let const_param = tcx.mk_const(param, expr.ty);
let literal = ConstantKind::Ty(const_param);
Constant { user_ty: None, span, literal }