Skip to content

Commit 36ee927

Browse files
committed
Fix ty::TyKind usage
1 parent 20a07f6 commit 36ee927

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

clippy_lints/src/consts.rs

+2-7
Original file line numberDiff line numberDiff line change
@@ -119,17 +119,12 @@ impl Hash for Constant {
119119
}
120120

121121
impl Constant {
122-
pub fn partial_cmp(
123-
tcx: TyCtxt<'_, '_, '_>,
124-
cmp_type: &ty::TyKind<'_>,
125-
left: &Self,
126-
right: &Self,
127-
) -> Option<Ordering> {
122+
pub fn partial_cmp(tcx: TyCtxt<'_, '_, '_>, cmp_type: ty::Ty<'_>, left: &Self, right: &Self) -> Option<Ordering> {
128123
match (left, right) {
129124
(&Constant::Str(ref ls), &Constant::Str(ref rs)) => Some(ls.cmp(rs)),
130125
(&Constant::Char(ref l), &Constant::Char(ref r)) => Some(l.cmp(r)),
131126
(&Constant::Int(l), &Constant::Int(r)) => {
132-
if let ty::Int(int_ty) = *cmp_type {
127+
if let ty::Int(int_ty) = cmp_type.sty {
133128
Some(sext(tcx, l, int_ty).cmp(&sext(tcx, r, int_ty)))
134129
} else {
135130
Some(l.cmp(&r))

clippy_lints/src/minmax.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MinMaxPass {
5151
}
5252
match (
5353
outer_max,
54-
Constant::partial_cmp(cx.tcx, &cx.tables.expr_ty(ie).sty, &outer_c, &inner_c),
54+
Constant::partial_cmp(cx.tcx, cx.tables.expr_ty(ie), &outer_c, &inner_c),
5555
) {
5656
(_, None) | (MinMax::Max, Some(Ordering::Less)) | (MinMax::Min, Some(Ordering::Greater)) => (),
5757
_ => {

0 commit comments

Comments
 (0)