Skip to content

Commit e426f26

Browse files
committed
Split up visit_path so MutVisitor has a path_segment method just like the immutable visitor
1 parent 545553c commit e426f26

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

compiler/rustc_ast/src/mut_visit.rs

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,10 @@ pub trait MutVisitor: Sized {
207207
noop_visit_path(p, self);
208208
}
209209

210+
fn visit_path_segment(&mut self, p: &mut PathSegment) {
211+
noop_visit_path_segment(p, self)
212+
}
213+
210214
fn visit_qself(&mut self, qs: &mut Option<P<QSelf>>) {
211215
noop_visit_qself(qs, self);
212216
}
@@ -554,11 +558,16 @@ fn noop_visit_ident<T: MutVisitor>(Ident { name: _, span }: &mut Ident, vis: &mu
554558
vis.visit_span(span);
555559
}
556560

561+
fn noop_visit_path_segment<T: MutVisitor>(segment: &mut PathSegment, vis: &mut T) {
562+
let PathSegment { ident, id, args } = segment;
563+
vis.visit_id(id);
564+
vis.visit_ident(ident);
565+
visit_opt(args, |args| vis.visit_generic_args(args));
566+
}
567+
557568
fn noop_visit_path<T: MutVisitor>(Path { segments, span, tokens }: &mut Path, vis: &mut T) {
558-
for PathSegment { ident, id, args } in segments {
559-
vis.visit_id(id);
560-
vis.visit_ident(ident);
561-
visit_opt(args, |args| vis.visit_generic_args(args));
569+
for segment in segments {
570+
vis.visit_path_segment(segment);
562571
}
563572
visit_lazy_tts(tokens, vis);
564573
vis.visit_span(span);

0 commit comments

Comments
 (0)