@@ -991,29 +991,29 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Methods {
991
991
}
992
992
}
993
993
994
- fn check_impl_item ( & mut self , cx : & LateContext < ' a , ' tcx > , implitem : & ' tcx hir:: ImplItem ) {
995
- if in_external_macro ( cx. sess ( ) , implitem . span ) {
994
+ fn check_impl_item ( & mut self , cx : & LateContext < ' a , ' tcx > , impl_item : & ' tcx hir:: ImplItem ) {
995
+ if in_external_macro ( cx. sess ( ) , impl_item . span ) {
996
996
return ;
997
997
}
998
- let name = implitem . ident . name . as_str ( ) ;
999
- let parent = cx. tcx . hir ( ) . get_parent_item ( implitem . hir_id ) ;
998
+ let name = impl_item . ident . name . as_str ( ) ;
999
+ let parent = cx. tcx . hir ( ) . get_parent_item ( impl_item . hir_id ) ;
1000
1000
let item = cx. tcx . hir ( ) . expect_item ( parent) ;
1001
1001
let def_id = cx. tcx . hir ( ) . local_def_id ( item. hir_id ) ;
1002
1002
let ty = cx. tcx . type_of ( def_id) ;
1003
1003
if_chain ! {
1004
- if let hir:: ImplItemKind :: Method ( ref sig, id) = implitem . node;
1004
+ if let hir:: ImplItemKind :: Method ( ref sig, id) = impl_item . node;
1005
1005
if let Some ( first_arg_ty) = sig. decl. inputs. get( 0 ) ;
1006
1006
if let Some ( first_arg) = iter_input_pats( & sig. decl, cx. tcx. hir( ) . body( id) ) . next( ) ;
1007
1007
if let hir:: ItemKind :: Impl ( _, _, _, _, None , ref self_ty, _) = item. node;
1008
1008
then {
1009
- if cx. access_levels. is_exported( implitem . hir_id) {
1009
+ if cx. access_levels. is_exported( impl_item . hir_id) {
1010
1010
// check missing trait implementations
1011
1011
for & ( method_name, n_args, self_kind, out_type, trait_name) in & TRAIT_METHODS {
1012
1012
if name == method_name &&
1013
1013
sig. decl. inputs. len( ) == n_args &&
1014
1014
out_type. matches( cx, & sig. decl. output) &&
1015
- self_kind. matches( cx, first_arg_ty, first_arg, self_ty, false , & implitem . generics) {
1016
- span_lint( cx, SHOULD_IMPLEMENT_TRAIT , implitem . span, & format!(
1015
+ self_kind. matches( cx, first_arg_ty, first_arg, self_ty, false , & impl_item . generics) {
1016
+ span_lint( cx, SHOULD_IMPLEMENT_TRAIT , impl_item . span, & format!(
1017
1017
"defining a method called `{}` on this type; consider implementing \
1018
1018
the `{}` trait or choosing a less ambiguous name", name, trait_name) ) ;
1019
1019
}
@@ -1026,7 +1026,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Methods {
1026
1026
if conv. check( & name) {
1027
1027
if !self_kinds
1028
1028
. iter( )
1029
- . any( |k| k. matches( cx, first_arg_ty, first_arg, self_ty, is_copy, & implitem . generics) ) {
1029
+ . any( |k| k. matches( cx, first_arg_ty, first_arg, self_ty, is_copy, & impl_item . generics) ) {
1030
1030
let lint = if item. vis. node. is_pub( ) {
1031
1031
WRONG_PUB_SELF_CONVENTION
1032
1032
} else {
@@ -1052,8 +1052,8 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Methods {
1052
1052
}
1053
1053
}
1054
1054
1055
- if let hir:: ImplItemKind :: Method ( _, _) = implitem . node {
1056
- let ret_ty = return_ty ( cx, implitem . hir_id ) ;
1055
+ if let hir:: ImplItemKind :: Method ( _, _) = impl_item . node {
1056
+ let ret_ty = return_ty ( cx, impl_item . hir_id ) ;
1057
1057
1058
1058
// walk the return type and check for Self (this does not check associated types)
1059
1059
for inner_type in ret_ty. walk ( ) {
@@ -1086,7 +1086,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Methods {
1086
1086
span_lint (
1087
1087
cx,
1088
1088
NEW_RET_NO_SELF ,
1089
- implitem . span ,
1089
+ impl_item . span ,
1090
1090
"methods called `new` usually return `Self`" ,
1091
1091
) ;
1092
1092
}
0 commit comments