Skip to content

Commit 29b10f3

Browse files
committed
Unify walk_mac_call
1 parent fafe93c commit 29b10f3

File tree

3 files changed

+13
-14
lines changed

3 files changed

+13
-14
lines changed

compiler/rustc_ast/src/visitors.rs

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ macro_rules! make_ast_visitor {
339339
make_visit!{Label; visit_label, walk_label}
340340
make_visit!{Lifetime, _ ctxt: LifetimeCtxt; visit_lifetime, walk_lifetime}
341341
make_visit!{Local; visit_local, walk_local}
342-
make_visit!{MacCall; visit_mac_call, walk_mac}
342+
make_visit!{MacCall; visit_mac_call, walk_mac_call}
343343
make_visit!{MutTy; visit_mt, walk_mt}
344344
make_visit!{Option<P<QSelf>>; visit_qself, walk_qself}
345345
make_visit!{Param; visit_param, walk_param}
@@ -776,6 +776,16 @@ macro_rules! make_ast_visitor {
776776
return_result!(V)
777777
}
778778

779+
pub fn walk_mac_call<$($lt,)? V: $trait$(<$lt>)?>(
780+
vis: &mut V,
781+
mac: ref_t!(MacCall)
782+
) -> result!(V) {
783+
let MacCall { path, args } = mac;
784+
try_v!(vis.visit_path(path, DUMMY_NODE_ID));
785+
visit_delim_args!(vis, args);
786+
return_result!(V)
787+
}
788+
779789
pub fn walk_mt<$($lt,)? V: $trait$(<$lt>)?>(
780790
vis: &mut V,
781791
mt: ref_t!(MutTy)
@@ -1544,11 +1554,6 @@ pub mod visit {
15441554
V::Result::output()
15451555
}
15461556

1547-
pub fn walk_mac<'a, V: Visitor<'a>>(visitor: &mut V, mac: &'a MacCall) -> V::Result {
1548-
let MacCall { path, args: _ } = mac;
1549-
visitor.visit_path(path, DUMMY_NODE_ID)
1550-
}
1551-
15521557
pub fn walk_expr<'a, V: Visitor<'a>>(visitor: &mut V, expression: &'a Expr) -> V::Result {
15531558
let Expr { id, kind, span, attrs, tokens: _ } = expression;
15541559
walk_list!(visitor, visit_attribute, attrs);
@@ -1879,12 +1884,6 @@ pub mod mut_visit {
18791884
vis.visit_span(span);
18801885
}
18811886

1882-
fn walk_mac<T: MutVisitor>(vis: &mut T, mac: &mut MacCall) {
1883-
let MacCall { path, args } = mac;
1884-
vis.visit_path(path, DUMMY_NODE_ID);
1885-
visit_delim_args(vis, args);
1886-
}
1887-
18881887
fn walk_macro_def<T: MutVisitor>(vis: &mut T, macro_def: &mut MacroDef) {
18891888
let MacroDef { body, macro_rules: _ } = macro_def;
18901889
visit_delim_args(vis, body);

compiler/rustc_ast_passes/src/node_count.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ impl<'ast> Visitor<'ast> for NodeCounter {
105105
}
106106
fn visit_mac_call(&mut self, mac: &MacCall) {
107107
self.count += 1;
108-
walk_mac(self, mac)
108+
walk_mac_call(self, mac)
109109
}
110110
fn visit_path(&mut self, path: &Path, _id: NodeId) {
111111
self.count += 1;

compiler/rustc_lint/src/early.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ impl<'a, T: EarlyLintPass> ast_visit::Visitor<'a> for EarlyContextAndPass<'a, T>
296296

297297
fn visit_mac_call(&mut self, mac: &'a ast::MacCall) {
298298
lint_callback!(self, check_mac, mac);
299-
ast_visit::walk_mac(self, mac);
299+
ast_visit::walk_mac_call(self, mac);
300300
}
301301
}
302302

0 commit comments

Comments
 (0)