diff --git a/compiler/rustc_ast/src/mut_visit.rs b/compiler/rustc_ast/src/mut_visit.rs
index 999ef3a01cd..f84929f5299 100644
--- a/compiler/rustc_ast/src/mut_visit.rs
+++ b/compiler/rustc_ast/src/mut_visit.rs
@@ -207,6 +207,10 @@ fn visit_path(&mut self, p: &mut Path) {
noop_visit_path(p, self);
}
+ fn visit_path_segment(&mut self, p: &mut PathSegment) {
+ noop_visit_path_segment(p, self)
+ }
+
fn visit_qself(&mut self, qs: &mut Option
>) {
noop_visit_qself(qs, self);
}
@@ -554,11 +558,16 @@ fn noop_visit_ident(Ident { name: _, span }: &mut Ident, vis: &mu
vis.visit_span(span);
}
+fn noop_visit_path_segment(segment: &mut PathSegment, vis: &mut T) {
+ let PathSegment { ident, id, args } = segment;
+ vis.visit_id(id);
+ vis.visit_ident(ident);
+ visit_opt(args, |args| vis.visit_generic_args(args));
+}
+
fn noop_visit_path(Path { segments, span, tokens }: &mut Path, vis: &mut T) {
- for PathSegment { ident, id, args } in segments {
- vis.visit_id(id);
- vis.visit_ident(ident);
- visit_opt(args, |args| vis.visit_generic_args(args));
+ for segment in segments {
+ vis.visit_path_segment(segment);
}
visit_lazy_tts(tokens, vis);
vis.visit_span(span);