@@ -37,7 +37,6 @@ use crate::itemlikevisit::{ItemLikeVisitor, ParItemLikeVisitor};
37
37
use rustc_ast:: ast:: { Attribute , Label } ;
38
38
use rustc_ast:: walk_list;
39
39
use rustc_span:: symbol:: { Ident , Symbol } ;
40
- use rustc_span:: Span ;
41
40
42
41
pub struct DeepVisitor < ' v , V > {
43
42
visitor : & ' v mut V ,
@@ -318,13 +317,13 @@ pub trait Visitor<'v>: Sized {
318
317
fn visit_id ( & mut self , _hir_id : HirId ) {
319
318
// Nothing to do.
320
319
}
321
- fn visit_name ( & mut self , _span : Span , _name : Symbol ) {
320
+ fn visit_name ( & mut self , _name : Symbol ) {
322
321
// Nothing to do.
323
322
}
324
323
fn visit_ident ( & mut self , ident : Ident ) {
325
324
walk_ident ( self , ident)
326
325
}
327
- fn visit_mod ( & mut self , m : & ' v Mod < ' v > , _s : Span , n : HirId ) {
326
+ fn visit_mod ( & mut self , m : & ' v Mod < ' v > , n : HirId ) {
328
327
walk_mod ( self , m, n)
329
328
}
330
329
fn visit_foreign_item ( & mut self , i : & ' v ForeignItem < ' v > ) {
@@ -366,8 +365,8 @@ pub trait Visitor<'v>: Sized {
366
365
fn visit_fn_decl ( & mut self , fd : & ' v FnDecl < ' v > ) {
367
366
walk_fn_decl ( self , fd)
368
367
}
369
- fn visit_fn ( & mut self , fk : FnKind < ' v > , fd : & ' v FnDecl < ' v > , b : BodyId , s : Span , id : HirId ) {
370
- walk_fn ( self , fk, fd, b, s , id)
368
+ fn visit_fn ( & mut self , fk : FnKind < ' v > , fd : & ' v FnDecl < ' v > , b : BodyId , id : HirId ) {
369
+ walk_fn ( self , fk, fd, b, id)
371
370
}
372
371
fn visit_use ( & mut self , path : & ' v Path < ' v > , hir_id : HirId ) {
373
372
walk_use ( self , path, hir_id)
@@ -399,7 +398,6 @@ pub trait Visitor<'v>: Sized {
399
398
_: Symbol ,
400
399
_: & ' v Generics < ' v > ,
401
400
_parent_id : HirId ,
402
- _: Span ,
403
401
) {
404
402
walk_struct_def ( self , s)
405
403
}
@@ -411,7 +409,6 @@ pub trait Visitor<'v>: Sized {
411
409
enum_definition : & ' v EnumDef < ' v > ,
412
410
generics : & ' v Generics < ' v > ,
413
411
item_id : HirId ,
414
- _: Span ,
415
412
) {
416
413
walk_enum_def ( self , enum_definition, generics, item_id)
417
414
}
@@ -431,17 +428,17 @@ pub trait Visitor<'v>: Sized {
431
428
fn visit_lifetime ( & mut self , lifetime : & ' v Lifetime ) {
432
429
walk_lifetime ( self , lifetime)
433
430
}
434
- fn visit_qpath ( & mut self , qpath : & ' v QPath < ' v > , id : HirId , span : Span ) {
435
- walk_qpath ( self , qpath, id, span )
431
+ fn visit_qpath ( & mut self , qpath : & ' v QPath < ' v > , id : HirId ) {
432
+ walk_qpath ( self , qpath, id)
436
433
}
437
434
fn visit_path ( & mut self , path : & ' v Path < ' v > , _id : HirId ) {
438
435
walk_path ( self , path)
439
436
}
440
- fn visit_path_segment ( & mut self , path_span : Span , path_segment : & ' v PathSegment < ' v > ) {
441
- walk_path_segment ( self , path_span , path_segment)
437
+ fn visit_path_segment ( & mut self , path_segment : & ' v PathSegment < ' v > ) {
438
+ walk_path_segment ( self , path_segment)
442
439
}
443
- fn visit_generic_args ( & mut self , path_span : Span , generic_args : & ' v GenericArgs < ' v > ) {
444
- walk_generic_args ( self , path_span , generic_args)
440
+ fn visit_generic_args ( & mut self , generic_args : & ' v GenericArgs < ' v > ) {
441
+ walk_generic_args ( self , generic_args)
445
442
}
446
443
fn visit_assoc_type_binding ( & mut self , type_binding : & ' v TypeBinding < ' v > ) {
447
444
walk_assoc_type_binding ( self , type_binding)
@@ -463,7 +460,7 @@ pub trait Visitor<'v>: Sized {
463
460
464
461
/// Walks the contents of a crate. See also `Crate::visit_all_items`.
465
462
pub fn walk_crate < ' v , V : Visitor < ' v > > ( visitor : & mut V , krate : & ' v Crate < ' v > ) {
466
- visitor. visit_mod ( & krate. item . module , krate . item . span , CRATE_HIR_ID ) ;
463
+ visitor. visit_mod ( & krate. item . module , CRATE_HIR_ID ) ;
467
464
walk_list ! ( visitor, visit_attribute, krate. item. attrs) ;
468
465
walk_list ! ( visitor, visit_macro_def, krate. exported_macros) ;
469
466
}
@@ -497,7 +494,7 @@ pub fn walk_local<'v, V: Visitor<'v>>(visitor: &mut V, local: &'v Local<'v>) {
497
494
}
498
495
499
496
pub fn walk_ident < ' v , V : Visitor < ' v > > ( visitor : & mut V , ident : Ident ) {
500
- visitor. visit_name ( ident. span , ident . name ) ;
497
+ visitor. visit_name ( ident. name ) ;
501
498
}
502
499
503
500
pub fn walk_label < ' v , V : Visitor < ' v > > ( visitor : & mut V , label : & ' v Label ) {
@@ -547,7 +544,7 @@ pub fn walk_item<'v, V: Visitor<'v>>(visitor: &mut V, item: &'v Item<'v>) {
547
544
ItemKind :: ExternCrate ( orig_name) => {
548
545
visitor. visit_id ( item. hir_id ) ;
549
546
if let Some ( orig_name) = orig_name {
550
- visitor. visit_name ( item . span , orig_name) ;
547
+ visitor. visit_name ( orig_name) ;
551
548
}
552
549
}
553
550
ItemKind :: Use ( ref path, _) => {
@@ -562,12 +559,11 @@ pub fn walk_item<'v, V: Visitor<'v>>(visitor: &mut V, item: &'v Item<'v>) {
562
559
FnKind :: ItemFn ( item. ident , generics, sig. header , & item. vis , & item. attrs ) ,
563
560
& sig. decl ,
564
561
body_id,
565
- item. span ,
566
562
item. hir_id ,
567
563
) ,
568
564
ItemKind :: Mod ( ref module) => {
569
565
// `visit_mod()` takes care of visiting the `Item`'s `HirId`.
570
- visitor. visit_mod ( module, item. span , item . hir_id )
566
+ visitor. visit_mod ( module, item. hir_id )
571
567
}
572
568
ItemKind :: ForeignMod ( ref foreign_module) => {
573
569
visitor. visit_id ( item. hir_id ) ;
@@ -589,7 +585,7 @@ pub fn walk_item<'v, V: Visitor<'v>>(visitor: &mut V, item: &'v Item<'v>) {
589
585
ItemKind :: Enum ( ref enum_definition, ref generics) => {
590
586
visitor. visit_generics ( generics) ;
591
587
// `visit_enum_def()` takes care of visiting the `Item`'s `HirId`.
592
- visitor. visit_enum_def ( enum_definition, generics, item. hir_id , item . span )
588
+ visitor. visit_enum_def ( enum_definition, generics, item. hir_id )
593
589
}
594
590
ItemKind :: Impl {
595
591
unsafety : _,
@@ -612,13 +608,7 @@ pub fn walk_item<'v, V: Visitor<'v>>(visitor: &mut V, item: &'v Item<'v>) {
612
608
| ItemKind :: Union ( ref struct_definition, ref generics) => {
613
609
visitor. visit_generics ( generics) ;
614
610
visitor. visit_id ( item. hir_id ) ;
615
- visitor. visit_variant_data (
616
- struct_definition,
617
- item. ident . name ,
618
- generics,
619
- item. hir_id ,
620
- item. span ,
621
- ) ;
611
+ visitor. visit_variant_data ( struct_definition, item. ident . name , generics, item. hir_id ) ;
622
612
}
623
613
ItemKind :: Trait ( .., ref generics, bounds, trait_item_refs) => {
624
614
visitor. visit_id ( item. hir_id ) ;
@@ -658,13 +648,7 @@ pub fn walk_variant<'v, V: Visitor<'v>>(
658
648
) {
659
649
visitor. visit_ident ( variant. ident ) ;
660
650
visitor. visit_id ( variant. id ) ;
661
- visitor. visit_variant_data (
662
- & variant. data ,
663
- variant. ident . name ,
664
- generics,
665
- parent_item_id,
666
- variant. span ,
667
- ) ;
651
+ visitor. visit_variant_data ( & variant. data , variant. ident . name , generics, parent_item_id) ;
668
652
walk_list ! ( visitor, visit_anon_const, & variant. disr_expr) ;
669
653
walk_list ! ( visitor, visit_attribute, variant. attrs) ;
670
654
}
@@ -688,7 +672,7 @@ pub fn walk_ty<'v, V: Visitor<'v>>(visitor: &mut V, typ: &'v Ty<'v>) {
688
672
visitor. visit_fn_decl ( & function_declaration. decl ) ;
689
673
}
690
674
TyKind :: Path ( ref qpath) => {
691
- visitor. visit_qpath ( qpath, typ. hir_id , typ . span ) ;
675
+ visitor. visit_qpath ( qpath, typ. hir_id ) ;
692
676
}
693
677
TyKind :: OpaqueDef ( item_id, lifetimes) => {
694
678
visitor. visit_nested_item ( item_id) ;
@@ -709,47 +693,34 @@ pub fn walk_ty<'v, V: Visitor<'v>>(visitor: &mut V, typ: &'v Ty<'v>) {
709
693
}
710
694
}
711
695
712
- pub fn walk_qpath < ' v , V : Visitor < ' v > > (
713
- visitor : & mut V ,
714
- qpath : & ' v QPath < ' v > ,
715
- id : HirId ,
716
- span : Span ,
717
- ) {
696
+ pub fn walk_qpath < ' v , V : Visitor < ' v > > ( visitor : & mut V , qpath : & ' v QPath < ' v > , id : HirId ) {
718
697
match * qpath {
719
698
QPath :: Resolved ( ref maybe_qself, ref path) => {
720
699
walk_list ! ( visitor, visit_ty, maybe_qself) ;
721
700
visitor. visit_path ( path, id)
722
701
}
723
702
QPath :: TypeRelative ( ref qself, ref segment) => {
724
703
visitor. visit_ty ( qself) ;
725
- visitor. visit_path_segment ( span , segment) ;
704
+ visitor. visit_path_segment ( segment) ;
726
705
}
727
706
}
728
707
}
729
708
730
709
pub fn walk_path < ' v , V : Visitor < ' v > > ( visitor : & mut V , path : & ' v Path < ' v > ) {
731
710
for segment in path. segments {
732
- visitor. visit_path_segment ( path . span , segment) ;
711
+ visitor. visit_path_segment ( segment) ;
733
712
}
734
713
}
735
714
736
- pub fn walk_path_segment < ' v , V : Visitor < ' v > > (
737
- visitor : & mut V ,
738
- path_span : Span ,
739
- segment : & ' v PathSegment < ' v > ,
740
- ) {
715
+ pub fn walk_path_segment < ' v , V : Visitor < ' v > > ( visitor : & mut V , segment : & ' v PathSegment < ' v > ) {
741
716
visitor. visit_ident ( segment. ident ) ;
742
717
walk_list ! ( visitor, visit_id, segment. hir_id) ;
743
718
if let Some ( ref args) = segment. args {
744
- visitor. visit_generic_args ( path_span , args) ;
719
+ visitor. visit_generic_args ( args) ;
745
720
}
746
721
}
747
722
748
- pub fn walk_generic_args < ' v , V : Visitor < ' v > > (
749
- visitor : & mut V ,
750
- _path_span : Span ,
751
- generic_args : & ' v GenericArgs < ' v > ,
752
- ) {
723
+ pub fn walk_generic_args < ' v , V : Visitor < ' v > > ( visitor : & mut V , generic_args : & ' v GenericArgs < ' v > ) {
753
724
walk_list ! ( visitor, visit_generic_arg, generic_args. args) ;
754
725
walk_list ! ( visitor, visit_assoc_type_binding, generic_args. bindings) ;
755
726
}
@@ -774,14 +745,14 @@ pub fn walk_pat<'v, V: Visitor<'v>>(visitor: &mut V, pattern: &'v Pat<'v>) {
774
745
visitor. visit_id ( pattern. hir_id ) ;
775
746
match pattern. kind {
776
747
PatKind :: TupleStruct ( ref qpath, children, _) => {
777
- visitor. visit_qpath ( qpath, pattern. hir_id , pattern . span ) ;
748
+ visitor. visit_qpath ( qpath, pattern. hir_id ) ;
778
749
walk_list ! ( visitor, visit_pat, children) ;
779
750
}
780
751
PatKind :: Path ( ref qpath) => {
781
- visitor. visit_qpath ( qpath, pattern. hir_id , pattern . span ) ;
752
+ visitor. visit_qpath ( qpath, pattern. hir_id ) ;
782
753
}
783
754
PatKind :: Struct ( ref qpath, fields, _) => {
784
- visitor. visit_qpath ( qpath, pattern. hir_id , pattern . span ) ;
755
+ visitor. visit_qpath ( qpath, pattern. hir_id ) ;
785
756
for field in fields {
786
757
visitor. visit_id ( field. hir_id ) ;
787
758
visitor. visit_ident ( field. ident ) ;
@@ -918,7 +889,6 @@ pub fn walk_fn<'v, V: Visitor<'v>>(
918
889
function_kind : FnKind < ' v > ,
919
890
function_declaration : & ' v FnDecl < ' v > ,
920
891
body_id : BodyId ,
921
- _span : Span ,
922
892
id : HirId ,
923
893
) {
924
894
visitor. visit_id ( id) ;
@@ -949,7 +919,6 @@ pub fn walk_trait_item<'v, V: Visitor<'v>>(visitor: &mut V, trait_item: &'v Trai
949
919
FnKind :: Method ( trait_item. ident , sig, None , & trait_item. attrs ) ,
950
920
& sig. decl ,
951
921
body_id,
952
- trait_item. span ,
953
922
trait_item. hir_id ,
954
923
) ;
955
924
}
@@ -999,7 +968,6 @@ pub fn walk_impl_item<'v, V: Visitor<'v>>(visitor: &mut V, impl_item: &'v ImplIt
999
968
FnKind :: Method ( impl_item. ident , sig, Some ( & impl_item. vis ) , & impl_item. attrs ) ,
1000
969
& sig. decl ,
1001
970
body_id,
1002
- impl_item. span ,
1003
971
impl_item. hir_id ,
1004
972
) ;
1005
973
}
@@ -1071,7 +1039,7 @@ pub fn walk_expr<'v, V: Visitor<'v>>(visitor: &mut V, expression: &'v Expr<'v>)
1071
1039
visitor. visit_anon_const ( count)
1072
1040
}
1073
1041
ExprKind :: Struct ( ref qpath, fields, ref optional_base) => {
1074
- visitor. visit_qpath ( qpath, expression. hir_id , expression . span ) ;
1042
+ visitor. visit_qpath ( qpath, expression. hir_id ) ;
1075
1043
for field in fields {
1076
1044
visitor. visit_id ( field. hir_id ) ;
1077
1045
visitor. visit_ident ( field. ident ) ;
@@ -1087,7 +1055,7 @@ pub fn walk_expr<'v, V: Visitor<'v>>(visitor: &mut V, expression: &'v Expr<'v>)
1087
1055
walk_list ! ( visitor, visit_expr, arguments) ;
1088
1056
}
1089
1057
ExprKind :: MethodCall ( ref segment, _, arguments, _) => {
1090
- visitor. visit_path_segment ( expression . span , segment) ;
1058
+ visitor. visit_path_segment ( segment) ;
1091
1059
walk_list ! ( visitor, visit_expr, arguments) ;
1092
1060
}
1093
1061
ExprKind :: Binary ( _, ref left_expression, ref right_expression) => {
@@ -1117,7 +1085,6 @@ pub fn walk_expr<'v, V: Visitor<'v>>(visitor: &mut V, expression: &'v Expr<'v>)
1117
1085
FnKind :: Closure ( & expression. attrs ) ,
1118
1086
function_declaration,
1119
1087
body,
1120
- expression. span ,
1121
1088
expression. hir_id ,
1122
1089
) ,
1123
1090
ExprKind :: Block ( ref block, ref opt_label) => {
@@ -1141,7 +1108,7 @@ pub fn walk_expr<'v, V: Visitor<'v>>(visitor: &mut V, expression: &'v Expr<'v>)
1141
1108
visitor. visit_expr ( index_expression)
1142
1109
}
1143
1110
ExprKind :: Path ( ref qpath) => {
1144
- visitor. visit_qpath ( qpath, expression. hir_id , expression . span ) ;
1111
+ visitor. visit_qpath ( qpath, expression. hir_id ) ;
1145
1112
}
1146
1113
ExprKind :: Break ( ref destination, ref opt_expr) => {
1147
1114
walk_list ! ( visitor, visit_label, & destination. label) ;
0 commit comments