@@ -316,8 +316,8 @@ pub trait Visitor<'v>: Sized {
316
316
fn visit_ident ( & mut self , ident : Ident ) -> Self :: Result {
317
317
walk_ident ( self , ident)
318
318
}
319
- fn visit_mod ( & mut self , m : & ' v Mod < ' v > , _s : Span , n : HirId ) -> Self :: Result {
320
- walk_mod ( self , m, n )
319
+ fn visit_mod ( & mut self , m : & ' v Mod < ' v > , _s : Span , _n : HirId ) -> Self :: Result {
320
+ walk_mod ( self , m)
321
321
}
322
322
fn visit_foreign_item ( & mut self , i : & ' v ForeignItem < ' v > ) -> Self :: Result {
323
323
walk_foreign_item ( self , i)
@@ -464,8 +464,8 @@ pub trait Visitor<'v>: Sized {
464
464
fn visit_field_def ( & mut self , s : & ' v FieldDef < ' v > ) -> Self :: Result {
465
465
walk_field_def ( self , s)
466
466
}
467
- fn visit_enum_def ( & mut self , enum_definition : & ' v EnumDef < ' v > , item_id : HirId ) -> Self :: Result {
468
- walk_enum_def ( self , enum_definition, item_id )
467
+ fn visit_enum_def ( & mut self , enum_definition : & ' v EnumDef < ' v > ) -> Self :: Result {
468
+ walk_enum_def ( self , enum_definition)
469
469
}
470
470
fn visit_variant ( & mut self , v : & ' v Variant < ' v > ) -> Self :: Result {
471
471
walk_variant ( self , v)
@@ -539,6 +539,7 @@ pub fn walk_item<'v, V: Visitor<'v>>(visitor: &mut V, item: &'v Item<'v>) -> V::
539
539
visit_opt ! ( visitor, visit_name, orig_name) ;
540
540
}
541
541
ItemKind :: Use ( ref path, _) => {
542
+ try_visit ! ( visitor. visit_id( item. hir_id( ) ) ) ;
542
543
try_visit ! ( visitor. visit_use( path, item. hir_id( ) ) ) ;
543
544
}
544
545
ItemKind :: Static ( ref typ, _, body) => {
@@ -566,7 +567,7 @@ pub fn walk_item<'v, V: Visitor<'v>>(visitor: &mut V, item: &'v Item<'v>) -> V::
566
567
try_visit ! ( visitor. visit_id( item. hir_id( ) ) ) ;
567
568
}
568
569
ItemKind :: Mod ( ref module) => {
569
- // `visit_mod()` takes care of visiting the `Item`'s `HirId`.
570
+ try_visit ! ( visitor . visit_id ( item . hir_id ( ) ) ) ;
570
571
try_visit ! ( visitor. visit_mod( module, item. span, item. hir_id( ) ) ) ;
571
572
}
572
573
ItemKind :: ForeignMod { abi : _, items } => {
@@ -587,9 +588,9 @@ pub fn walk_item<'v, V: Visitor<'v>>(visitor: &mut V, item: &'v Item<'v>) -> V::
587
588
try_visit ! ( visitor. visit_generics( generics) ) ;
588
589
}
589
590
ItemKind :: Enum ( ref enum_definition, ref generics) => {
591
+ try_visit ! ( visitor. visit_id( item. hir_id( ) ) ) ;
590
592
try_visit ! ( visitor. visit_generics( generics) ) ;
591
- // `visit_enum_def()` takes care of visiting the `Item`'s `HirId`.
592
- try_visit ! ( visitor. visit_enum_def( enum_definition, item. hir_id( ) ) ) ;
593
+ try_visit ! ( visitor. visit_enum_def( enum_definition) ) ;
593
594
}
594
595
ItemKind :: Impl ( Impl {
595
596
constness : _,
@@ -638,12 +639,7 @@ pub fn walk_ident<'v, V: Visitor<'v>>(visitor: &mut V, ident: Ident) -> V::Resul
638
639
visitor. visit_name ( ident. name )
639
640
}
640
641
641
- pub fn walk_mod < ' v , V : Visitor < ' v > > (
642
- visitor : & mut V ,
643
- module : & ' v Mod < ' v > ,
644
- mod_hir_id : HirId ,
645
- ) -> V :: Result {
646
- try_visit ! ( visitor. visit_id( mod_hir_id) ) ;
642
+ pub fn walk_mod < ' v , V : Visitor < ' v > > ( visitor : & mut V , module : & ' v Mod < ' v > ) -> V :: Result {
647
643
walk_list ! ( visitor, visit_nested_item, module. item_ids. iter( ) . copied( ) ) ;
648
644
V :: Result :: output ( )
649
645
}
@@ -1145,7 +1141,6 @@ pub fn walk_use<'v, V: Visitor<'v>>(
1145
1141
path : & ' v UsePath < ' v > ,
1146
1142
hir_id : HirId ,
1147
1143
) -> V :: Result {
1148
- try_visit ! ( visitor. visit_id( hir_id) ) ;
1149
1144
let UsePath { segments, ref res, span } = * path;
1150
1145
for & res in res {
1151
1146
try_visit ! ( visitor. visit_path( & Path { segments, res, span } , hir_id) ) ;
@@ -1326,9 +1321,7 @@ pub fn walk_field_def<'v, V: Visitor<'v>>(
1326
1321
pub fn walk_enum_def < ' v , V : Visitor < ' v > > (
1327
1322
visitor : & mut V ,
1328
1323
enum_definition : & ' v EnumDef < ' v > ,
1329
- item_id : HirId ,
1330
1324
) -> V :: Result {
1331
- try_visit ! ( visitor. visit_id( item_id) ) ;
1332
1325
walk_list ! ( visitor, visit_variant, enum_definition. variants) ;
1333
1326
V :: Result :: output ( )
1334
1327
}
0 commit comments