Skip to content

Commit 40285ca

Browse files
committed
Apply visit_path to import prefixes by default
1 parent dd6e8d4 commit 40285ca

File tree

3 files changed

+8
-26
lines changed

3 files changed

+8
-26
lines changed

src/librustc/hir/intravisit.rs

+4-11
Original file line numberDiff line numberDiff line change
@@ -274,12 +274,9 @@ pub fn walk_item<'v, V: Visitor<'v>>(visitor: &mut V, item: &'v Item) {
274274
visitor.visit_path(path, item.id);
275275
}
276276
ViewPathList(ref prefix, ref list) => {
277-
if !list.is_empty() {
278-
for item in list {
279-
visitor.visit_path_list_item(prefix, item)
280-
}
281-
} else {
282-
visitor.visit_path(prefix, item.id);
277+
visitor.visit_path(prefix, item.id);
278+
for item in list {
279+
visitor.visit_path_list_item(prefix, item)
283280
}
284281
}
285282
}
@@ -413,12 +410,8 @@ pub fn walk_path<'v, V: Visitor<'v>>(visitor: &mut V, path: &'v Path) {
413410
}
414411

415412
pub fn walk_path_list_item<'v, V: Visitor<'v>>(visitor: &mut V,
416-
prefix: &'v Path,
413+
_prefix: &'v Path,
417414
item: &'v PathListItem) {
418-
for segment in &prefix.segments {
419-
visitor.visit_path_segment(prefix.span, segment);
420-
}
421-
422415
walk_opt_name(visitor, item.span, item.node.name());
423416
walk_opt_name(visitor, item.span, item.node.rename());
424417
}

src/librustc_incremental/calculate_svh.rs

-4
Original file line numberDiff line numberDiff line change
@@ -401,10 +401,6 @@ mod svh_visitor {
401401
SawPath.hash(self.st); visit::walk_path(self, path)
402402
}
403403

404-
fn visit_path_list_item(&mut self, prefix: &'a Path, item: &'a PathListItem) {
405-
SawPath.hash(self.st); visit::walk_path_list_item(self, prefix, item)
406-
}
407-
408404
fn visit_block(&mut self, b: &'a Block) {
409405
SawBlock.hash(self.st); visit::walk_block(self, b)
410406
}

src/libsyntax/visit.rs

+4-11
Original file line numberDiff line numberDiff line change
@@ -247,12 +247,9 @@ pub fn walk_item<'v, V: Visitor<'v>>(visitor: &mut V, item: &'v Item) {
247247
visitor.visit_path(path, item.id);
248248
}
249249
ViewPathList(ref prefix, ref list) => {
250-
if !list.is_empty() {
251-
for item in list {
252-
visitor.visit_path_list_item(prefix, item)
253-
}
254-
} else {
255-
visitor.visit_path(prefix, item.id);
250+
visitor.visit_path(prefix, item.id);
251+
for item in list {
252+
visitor.visit_path_list_item(prefix, item)
256253
}
257254
}
258255
}
@@ -382,12 +379,8 @@ pub fn walk_path<'v, V: Visitor<'v>>(visitor: &mut V, path: &'v Path) {
382379
}
383380
}
384381

385-
pub fn walk_path_list_item<'v, V: Visitor<'v>>(visitor: &mut V, prefix: &'v Path,
382+
pub fn walk_path_list_item<'v, V: Visitor<'v>>(visitor: &mut V, _prefix: &'v Path,
386383
item: &'v PathListItem) {
387-
for segment in &prefix.segments {
388-
visitor.visit_path_segment(prefix.span, segment);
389-
}
390-
391384
walk_opt_ident(visitor, item.span, item.node.name());
392385
walk_opt_ident(visitor, item.span, item.node.rename());
393386
}

0 commit comments

Comments
 (0)