@@ -298,7 +298,7 @@ pub trait Visitor<'v>: Sized {
298
298
fn visit_id ( & mut self , _hir_id : HirId ) {
299
299
// Nothing to do.
300
300
}
301
- fn visit_name ( & mut self , _span : Span , _name : Symbol ) {
301
+ fn visit_name ( & mut self , _name : Symbol ) {
302
302
// Nothing to do.
303
303
}
304
304
fn visit_ident ( & mut self , ident : Ident ) {
@@ -361,8 +361,8 @@ pub trait Visitor<'v>: Sized {
361
361
fn visit_fn_decl ( & mut self , fd : & ' v FnDecl < ' v > ) {
362
362
walk_fn_decl ( self , fd)
363
363
}
364
- fn visit_fn ( & mut self , fk : FnKind < ' v > , fd : & ' v FnDecl < ' v > , b : BodyId , s : Span , id : HirId ) {
365
- walk_fn ( self , fk, fd, b, s , id)
364
+ fn visit_fn ( & mut self , fk : FnKind < ' v > , fd : & ' v FnDecl < ' v > , b : BodyId , _ : Span , id : HirId ) {
365
+ walk_fn ( self , fk, fd, b, id)
366
366
}
367
367
fn visit_use ( & mut self , path : & ' v Path < ' v > , hir_id : HirId ) {
368
368
walk_use ( self , path, hir_id)
@@ -388,8 +388,8 @@ pub trait Visitor<'v>: Sized {
388
388
fn visit_param_bound ( & mut self , bounds : & ' v GenericBound < ' v > ) {
389
389
walk_param_bound ( self , bounds)
390
390
}
391
- fn visit_poly_trait_ref ( & mut self , t : & ' v PolyTraitRef < ' v > , m : TraitBoundModifier ) {
392
- walk_poly_trait_ref ( self , t, m )
391
+ fn visit_poly_trait_ref ( & mut self , t : & ' v PolyTraitRef < ' v > ) {
392
+ walk_poly_trait_ref ( self , t)
393
393
}
394
394
fn visit_variant_data ( & mut self , s : & ' v VariantData < ' v > ) {
395
395
walk_struct_def ( self , s)
@@ -420,17 +420,18 @@ pub trait Visitor<'v>: Sized {
420
420
fn visit_lifetime ( & mut self , lifetime : & ' v Lifetime ) {
421
421
walk_lifetime ( self , lifetime)
422
422
}
423
- fn visit_qpath ( & mut self , qpath : & ' v QPath < ' v > , id : HirId , span : Span ) {
424
- walk_qpath ( self , qpath, id, span)
423
+ // The span is that of the surrounding type/pattern/expr/whatever.
424
+ fn visit_qpath ( & mut self , qpath : & ' v QPath < ' v > , id : HirId , _span : Span ) {
425
+ walk_qpath ( self , qpath, id)
425
426
}
426
427
fn visit_path ( & mut self , path : & ' v Path < ' v > , _id : HirId ) {
427
428
walk_path ( self , path)
428
429
}
429
- fn visit_path_segment ( & mut self , path_span : Span , path_segment : & ' v PathSegment < ' v > ) {
430
- walk_path_segment ( self , path_span , path_segment)
430
+ fn visit_path_segment ( & mut self , path_segment : & ' v PathSegment < ' v > ) {
431
+ walk_path_segment ( self , path_segment)
431
432
}
432
- fn visit_generic_args ( & mut self , path_span : Span , generic_args : & ' v GenericArgs < ' v > ) {
433
- walk_generic_args ( self , path_span , generic_args)
433
+ fn visit_generic_args ( & mut self , generic_args : & ' v GenericArgs < ' v > ) {
434
+ walk_generic_args ( self , generic_args)
434
435
}
435
436
fn visit_assoc_type_binding ( & mut self , type_binding : & ' v TypeBinding < ' v > ) {
436
437
walk_assoc_type_binding ( self , type_binding)
@@ -472,7 +473,7 @@ pub fn walk_local<'v, V: Visitor<'v>>(visitor: &mut V, local: &'v Local<'v>) {
472
473
}
473
474
474
475
pub fn walk_ident < ' v , V : Visitor < ' v > > ( visitor : & mut V , ident : Ident ) {
475
- visitor. visit_name ( ident. span , ident . name ) ;
476
+ visitor. visit_name ( ident. name ) ;
476
477
}
477
478
478
479
pub fn walk_label < ' v , V : Visitor < ' v > > ( visitor : & mut V , label : & ' v Label ) {
@@ -494,11 +495,7 @@ pub fn walk_lifetime<'v, V: Visitor<'v>>(visitor: &mut V, lifetime: &'v Lifetime
494
495
}
495
496
}
496
497
497
- pub fn walk_poly_trait_ref < ' v , V : Visitor < ' v > > (
498
- visitor : & mut V ,
499
- trait_ref : & ' v PolyTraitRef < ' v > ,
500
- _modifier : TraitBoundModifier ,
501
- ) {
498
+ pub fn walk_poly_trait_ref < ' v , V : Visitor < ' v > > ( visitor : & mut V , trait_ref : & ' v PolyTraitRef < ' v > ) {
502
499
walk_list ! ( visitor, visit_generic_param, trait_ref. bound_generic_params) ;
503
500
visitor. visit_trait_ref ( & trait_ref. trait_ref ) ;
504
501
}
@@ -519,7 +516,7 @@ pub fn walk_item<'v, V: Visitor<'v>>(visitor: &mut V, item: &'v Item<'v>) {
519
516
ItemKind :: ExternCrate ( orig_name) => {
520
517
visitor. visit_id ( item. hir_id ( ) ) ;
521
518
if let Some ( orig_name) = orig_name {
522
- visitor. visit_name ( item . span , orig_name) ;
519
+ visitor. visit_name ( orig_name) ;
523
520
}
524
521
}
525
522
ItemKind :: Use ( ref path, _) => {
@@ -680,7 +677,7 @@ pub fn walk_ty<'v, V: Visitor<'v>>(visitor: &mut V, typ: &'v Ty<'v>) {
680
677
}
681
678
TyKind :: TraitObject ( bounds, ref lifetime, _syntax) => {
682
679
for bound in bounds {
683
- visitor. visit_poly_trait_ref ( bound, TraitBoundModifier :: None ) ;
680
+ visitor. visit_poly_trait_ref ( bound) ;
684
681
}
685
682
visitor. visit_lifetime ( lifetime) ;
686
683
}
@@ -693,48 +690,35 @@ pub fn walk_inf<'v, V: Visitor<'v>>(visitor: &mut V, inf: &'v InferArg) {
693
690
visitor. visit_id ( inf. hir_id ) ;
694
691
}
695
692
696
- pub fn walk_qpath < ' v , V : Visitor < ' v > > (
697
- visitor : & mut V ,
698
- qpath : & ' v QPath < ' v > ,
699
- id : HirId ,
700
- span : Span ,
701
- ) {
693
+ pub fn walk_qpath < ' v , V : Visitor < ' v > > ( visitor : & mut V , qpath : & ' v QPath < ' v > , id : HirId ) {
702
694
match * qpath {
703
695
QPath :: Resolved ( ref maybe_qself, ref path) => {
704
696
walk_list ! ( visitor, visit_ty, maybe_qself) ;
705
697
visitor. visit_path ( path, id)
706
698
}
707
699
QPath :: TypeRelative ( ref qself, ref segment) => {
708
700
visitor. visit_ty ( qself) ;
709
- visitor. visit_path_segment ( span , segment) ;
701
+ visitor. visit_path_segment ( segment) ;
710
702
}
711
703
QPath :: LangItem ( ..) => { }
712
704
}
713
705
}
714
706
715
707
pub fn walk_path < ' v , V : Visitor < ' v > > ( visitor : & mut V , path : & ' v Path < ' v > ) {
716
708
for segment in path. segments {
717
- visitor. visit_path_segment ( path . span , segment) ;
709
+ visitor. visit_path_segment ( segment) ;
718
710
}
719
711
}
720
712
721
- pub fn walk_path_segment < ' v , V : Visitor < ' v > > (
722
- visitor : & mut V ,
723
- path_span : Span ,
724
- segment : & ' v PathSegment < ' v > ,
725
- ) {
713
+ pub fn walk_path_segment < ' v , V : Visitor < ' v > > ( visitor : & mut V , segment : & ' v PathSegment < ' v > ) {
726
714
visitor. visit_ident ( segment. ident ) ;
727
715
visitor. visit_id ( segment. hir_id ) ;
728
716
if let Some ( ref args) = segment. args {
729
- visitor. visit_generic_args ( path_span , args) ;
717
+ visitor. visit_generic_args ( args) ;
730
718
}
731
719
}
732
720
733
- pub fn walk_generic_args < ' v , V : Visitor < ' v > > (
734
- visitor : & mut V ,
735
- _path_span : Span ,
736
- generic_args : & ' v GenericArgs < ' v > ,
737
- ) {
721
+ pub fn walk_generic_args < ' v , V : Visitor < ' v > > ( visitor : & mut V , generic_args : & ' v GenericArgs < ' v > ) {
738
722
walk_list ! ( visitor, visit_generic_arg, generic_args. args) ;
739
723
walk_list ! ( visitor, visit_assoc_type_binding, generic_args. bindings) ;
740
724
}
@@ -745,7 +729,7 @@ pub fn walk_assoc_type_binding<'v, V: Visitor<'v>>(
745
729
) {
746
730
visitor. visit_id ( type_binding. hir_id ) ;
747
731
visitor. visit_ident ( type_binding. ident ) ;
748
- visitor. visit_generic_args ( type_binding. span , type_binding . gen_args ) ;
732
+ visitor. visit_generic_args ( type_binding. gen_args ) ;
749
733
match type_binding. kind {
750
734
TypeBindingKind :: Equality { ref term } => match term {
751
735
Term :: Ty ( ref ty) => visitor. visit_ty ( ty) ,
@@ -819,12 +803,12 @@ pub fn walk_foreign_item<'v, V: Visitor<'v>>(visitor: &mut V, foreign_item: &'v
819
803
820
804
pub fn walk_param_bound < ' v , V : Visitor < ' v > > ( visitor : & mut V , bound : & ' v GenericBound < ' v > ) {
821
805
match * bound {
822
- GenericBound :: Trait ( ref typ, modifier ) => {
823
- visitor. visit_poly_trait_ref ( typ, modifier ) ;
806
+ GenericBound :: Trait ( ref typ, _modifier ) => {
807
+ visitor. visit_poly_trait_ref ( typ) ;
824
808
}
825
- GenericBound :: LangItemTrait ( _, span , hir_id, args) => {
809
+ GenericBound :: LangItemTrait ( _, _span , hir_id, args) => {
826
810
visitor. visit_id ( hir_id) ;
827
- visitor. visit_generic_args ( span , args) ;
811
+ visitor. visit_generic_args ( args) ;
828
812
}
829
813
GenericBound :: Outlives ( ref lifetime) => visitor. visit_lifetime ( lifetime) ,
830
814
}
@@ -910,7 +894,6 @@ pub fn walk_fn<'v, V: Visitor<'v>>(
910
894
function_kind : FnKind < ' v > ,
911
895
function_declaration : & ' v FnDecl < ' v > ,
912
896
body_id : BodyId ,
913
- _span : Span ,
914
897
id : HirId ,
915
898
) {
916
899
visitor. visit_id ( id) ;
@@ -1095,7 +1078,7 @@ pub fn walk_expr<'v, V: Visitor<'v>>(visitor: &mut V, expression: &'v Expr<'v>)
1095
1078
walk_list ! ( visitor, visit_expr, arguments) ;
1096
1079
}
1097
1080
ExprKind :: MethodCall ( ref segment, receiver, arguments, _) => {
1098
- visitor. visit_path_segment ( expression . span , segment) ;
1081
+ visitor. visit_path_segment ( segment) ;
1099
1082
visitor. visit_expr ( receiver) ;
1100
1083
walk_list ! ( visitor, visit_expr, arguments) ;
1101
1084
}
0 commit comments