@@ -3,7 +3,7 @@ use crate::utils::differing_macro_contexts;
33use rustc:: hir:: ptr:: P ;
44use rustc:: hir:: * ;
55use rustc:: lint:: LateContext ;
6- use rustc:: ty:: { self , Ty , TypeckTables } ;
6+ use rustc:: ty:: { self , TypeckTables } ;
77use std:: collections:: hash_map:: DefaultHasher ;
88use std:: hash:: { Hash , Hasher } ;
99use 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,8 +257,8 @@ impl<'a, 'tcx> SpanlessEq<'a, 'tcx> {
257257 }
258258 }
259259
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 )
262262 }
263263
264264 #[ allow( clippy:: similar_names) ]
@@ -604,8 +604,12 @@ impl<'a, 'tcx> SpanlessHash<'a, 'tcx> {
604604 }
605605 }
606606
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 ) ;
609613 match ty {
610614 TyKind :: Slice ( ty) => {
611615 self . hash_ty ( ty) ;
@@ -665,7 +669,7 @@ impl<'a, 'tcx> SpanlessHash<'a, 'tcx> {
665669 for arg in arg_list {
666670 match arg {
667671 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) ,
669673 GenericArg :: Const ( ref ca) => {
670674 self . hash_expr ( & self . cx . tcx . hir ( ) . body ( ca. value . body ) . value ) ;
671675 } ,
0 commit comments