@@ -3,7 +3,7 @@ use crate::utils::differing_macro_contexts;
3
3
use rustc:: hir:: ptr:: P ;
4
4
use rustc:: hir:: * ;
5
5
use rustc:: lint:: LateContext ;
6
- use rustc:: ty:: { self , Ty , TypeckTables } ;
6
+ use rustc:: ty:: { self , TypeckTables } ;
7
7
use std:: collections:: hash_map:: DefaultHasher ;
8
8
use std:: hash:: { Hash , Hasher } ;
9
9
use syntax:: ast:: Name ;
@@ -45,7 +45,7 @@ impl<'a, 'tcx> SpanlessEq<'a, 'tcx> {
45
45
match ( & left. node , & right. node ) {
46
46
( & StmtKind :: Local ( ref l) , & StmtKind :: Local ( ref r) ) => {
47
47
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) )
49
49
&& both ( & l. init , & r. init , |l, r| self . eq_expr ( l, r) )
50
50
} ,
51
51
( & StmtKind :: Expr ( ref l) , & StmtKind :: Expr ( ref r) ) | ( & StmtKind :: Semi ( ref l) , & StmtKind :: Semi ( ref r) ) => {
@@ -257,8 +257,8 @@ impl<'a, 'tcx> SpanlessEq<'a, 'tcx> {
257
257
}
258
258
}
259
259
260
- pub fn eq_ty ( & mut self , left : & Ty < ' tcx > , right : & Ty < ' tcx > ) -> bool {
261
- self . eq_ty_kind ( & left. sty , & right. sty )
260
+ pub fn eq_ty ( & mut self , left : & Ty , right : & Ty ) -> bool {
261
+ self . eq_ty_kind ( & left. node , & right. node )
262
262
}
263
263
264
264
#[ allow( clippy:: similar_names) ]
@@ -604,8 +604,12 @@ impl<'a, 'tcx> SpanlessHash<'a, 'tcx> {
604
604
}
605
605
}
606
606
607
- pub fn hash_ty ( & mut self , ty : & TyKind ) {
608
- std:: mem:: discriminant ( & ty. node ) . hash ( & mut self . s ) ;
607
+ pub fn hash_ty ( & mut self , ty : & Ty ) {
608
+ self . hash_tykind ( & ty. node ) ;
609
+ }
610
+
611
+ pub fn hash_tykind ( & mut self , ty : & TyKind ) {
612
+ std:: mem:: discriminant ( & ty) . hash ( & mut self . s ) ;
609
613
match ty {
610
614
TyKind :: Slice ( ty) => {
611
615
self . hash_ty ( ty) ;
@@ -665,7 +669,7 @@ impl<'a, 'tcx> SpanlessHash<'a, 'tcx> {
665
669
for arg in arg_list {
666
670
match arg {
667
671
GenericArg :: Lifetime ( ref l) => self . hash_lifetime ( l) ,
668
- GenericArg :: Type ( ref ty) => self . hash_ty ( ty) ,
672
+ GenericArg :: Type ( ref ty) => self . hash_ty ( & ty) ,
669
673
GenericArg :: Const ( ref ca) => {
670
674
self . hash_expr ( & self . cx . tcx . hir ( ) . body ( ca. value . body ) . value ) ;
671
675
} ,
0 commit comments