@@ -121,6 +121,9 @@ pub trait Visitor<'v> : Sized {
121121 fn visit_path ( & mut self , path : & ' v Path , _id : NodeId ) {
122122 walk_path ( self , path)
123123 }
124+ fn visit_path_list_item ( & mut self , prefix : & ' v Path , item : & ' v PathListItem ) {
125+ walk_path_list_item ( self , prefix, item)
126+ }
124127 fn visit_path_segment ( & mut self , path_span : Span , path_segment : & ' v PathSegment ) {
125128 walk_path_segment ( self , path_span, path_segment)
126129 }
@@ -203,26 +206,20 @@ pub fn walk_item<'v, V: Visitor<'v>>(visitor: &mut V, item: &'v Item) {
203206 ItemExternCrate ( ..) => { }
204207 ItemUse ( ref vp) => {
205208 match vp. node {
206- ViewPathSimple ( ident, ref path) => {
207- visitor. visit_ident ( vp. span , ident) ;
209+ ViewPathSimple ( _ident, ref path) => {
208210 visitor. visit_path ( path, item. id ) ;
209211 }
210212 ViewPathGlob ( ref path) => {
211213 visitor. visit_path ( path, item. id ) ;
212214 }
213215 ViewPathList ( ref prefix, ref list) => {
214- for id in list {
215- match id. node {
216- PathListIdent { name, .. } => {
217- visitor. visit_ident ( id. span , name) ;
218- }
219- PathListMod { .. } => ( )
216+ if !list. is_empty ( ) {
217+ for item in list {
218+ visitor. visit_path_list_item ( prefix, item)
220219 }
220+ } else {
221+ visitor. visit_path ( prefix, item. id ) ;
221222 }
222-
223- // Note that the `prefix` here is not a complete
224- // path, so we don't use `visit_path`.
225- walk_path ( visitor, prefix) ;
226223 }
227224 }
228225 }
@@ -400,6 +397,17 @@ pub fn walk_path<'v, V: Visitor<'v>>(visitor: &mut V, path: &'v Path) {
400397 }
401398}
402399
400+ pub fn walk_path_list_item < ' v , V : Visitor < ' v > > ( visitor : & mut V , prefix : & ' v Path ,
401+ item : & ' v PathListItem ) {
402+ for segment in & prefix. segments {
403+ visitor. visit_path_segment ( prefix. span , segment) ;
404+ }
405+
406+ if let PathListIdent { name, .. } = item. node {
407+ visitor. visit_ident ( item. span , name) ;
408+ }
409+ }
410+
403411pub fn walk_path_segment < ' v , V : Visitor < ' v > > ( visitor : & mut V ,
404412 path_span : Span ,
405413 segment : & ' v PathSegment ) {
0 commit comments