Skip to content

Commit f3e4467

Browse files
committed
Changed Ty to ty, added lifetime 'tcx
1 parent f71d59e commit f3e4467

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

clippy_lints/src/utils/hir_utils.rs

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use crate::utils::differing_macro_contexts;
33
use rustc::hir::ptr::P;
44
use rustc::hir::*;
55
use rustc::lint::LateContext;
6-
use rustc::ty::{Ty, TypeckTables};
6+
use rustc::ty::{self, Ty, TypeckTables};
77
use std::collections::hash_map::DefaultHasher;
88
use std::hash::{Hash, Hasher};
99
use syntax::ast::Name;
@@ -45,7 +45,7 @@ impl<'a, 'tcx> SpanlessEq<'a, 'tcx> {
4545
match (&left.node, &right.node) {
4646
(&StmtKind::Local(ref l), &StmtKind::Local(ref r)) => {
4747
self.eq_pat(&l.pat, &r.pat)
48-
&& both(&l.ty, &r.ty, |l, r| self.eq_ty(l, r))
48+
&& both(&l.ty, &r.ty, |l, r| self.eq_ty(*l, *r))
4949
&& both(&l.init, &r.init, |l, r| self.eq_expr(l, r))
5050
},
5151
(&StmtKind::Expr(ref l), &StmtKind::Expr(ref r)) | (&StmtKind::Semi(ref l), &StmtKind::Semi(ref r)) => {
@@ -257,7 +257,7 @@ impl<'a, 'tcx> SpanlessEq<'a, 'tcx> {
257257
}
258258
}
259259

260-
pub fn eq_ty(&mut self, left: &Ty, right: &Ty) -> bool {
260+
pub fn eq_ty(&mut self, left: &Ty<'tcx>, right: &Ty<'tcx>) -> bool {
261261
self.eq_ty_kind(&left.node, &right.node)
262262
}
263263

@@ -604,26 +604,26 @@ impl<'a, 'tcx> SpanlessHash<'a, 'tcx> {
604604
}
605605
}
606606

607-
pub fn hash_ty(&mut self, ty: &Ty) {
607+
pub fn hash_ty(&mut self, ty: &Ty<'tcx>) {
608608
std::mem::discriminant(&ty.node).hash(&mut self.s);
609-
match ty.node {
610-
Ty::Slice(ty) => {
609+
match ty.sty {
610+
ty::Slice(ty) => {
611611
self.hash_ty(ty);
612612
},
613-
Ty::Array(ty, anon_const) => {
613+
ty::Array(ty, anon_const) => {
614614
self.hash_ty(ty);
615615
self.hash_expr(&self.cx.tcx.hir().body(anon_const.body).value);
616616
},
617-
Ty::Ptr(mut_ty) => {
617+
ty::Ptr(mut_ty) => {
618618
self.hash_ty(&mut_ty.ty);
619619
mut_ty.mutbl.hash(&mut self.s);
620620
},
621-
Ty::Rptr(lifetime, mut_ty) => {
621+
ty::Rptr(lifetime, mut_ty) => {
622622
self.hash_lifetime(lifetime);
623623
self.hash_ty(&mut_ty.ty);
624624
mut_ty.mutbl.hash(&mut self.s);
625625
},
626-
Ty::BareFn(bfn) => {
626+
ty::BareFn(bfn) => {
627627
bfn.unsafety.hash(&mut self.s);
628628
bfn.abi.hash(&mut self.s);
629629
for arg in &bfn.decl.inputs {
@@ -639,13 +639,13 @@ impl<'a, 'tcx> SpanlessHash<'a, 'tcx> {
639639
}
640640
bfn.decl.c_variadic.hash(&mut self.s);
641641
},
642-
Ty::Tup(ty_list) => {
642+
ty::Tup(ty_list) => {
643643
for ty in ty_list {
644644
self.hash_ty(ty);
645645
}
646646

647647
},
648-
Ty::Path(qpath) => {
648+
ty::Path(qpath) => {
649649
match qpath {
650650
QPath::Resolved(ref maybe_ty, ref path) => {
651651
if let Some(ref ty) = maybe_ty {
@@ -661,7 +661,7 @@ impl<'a, 'tcx> SpanlessHash<'a, 'tcx> {
661661
},
662662
}
663663
},
664-
Ty::Def(_, arg_list) => {
664+
ty::Def(_, arg_list) => {
665665
for arg in arg_list {
666666
match arg {
667667
GenericArg::Lifetime(ref l) => self.hash_lifetime(l),
@@ -672,17 +672,17 @@ impl<'a, 'tcx> SpanlessHash<'a, 'tcx> {
672672
}
673673
}
674674
},
675-
Ty::TraitObject(_, lifetime) => {
675+
ty::TraitObject(_, lifetime) => {
676676
self.hash_lifetime(lifetime);
677677

678678
},
679-
Ty::Typeof(anon_const) => {
679+
ty::Typeof(anon_const) => {
680680
self.hash_expr(&self.cx.tcx.hir().body(anon_const.body).value);
681681
},
682-
Ty::CVarArgs(lifetime) => {
682+
ty::CVarArgs(lifetime) => {
683683
self.hash_lifetime(lifetime);
684684
},
685-
Ty::Err | Ty::Infer | Ty::Never => {},
685+
ty::Err | ty::Infer | ty::Never => {},
686686
}
687687
}
688688
}

0 commit comments

Comments
 (0)