Skip to content

Commit a4e6bf4

Browse files
committed
Unify walk_closure_binder
1 parent 53cede0 commit a4e6bf4

File tree

1 file changed

+14
-22
lines changed

1 file changed

+14
-22
lines changed

compiler/rustc_ast/src/visitors.rs

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,20 @@ macro_rules! make_ast_visitor {
380380
return_result!(V)
381381
}
382382

383+
pub fn walk_closure_binder<$($lt,)? V: $trait$(<$lt>)?>(
384+
vis: &mut V,
385+
binder: ref_t!(ClosureBinder)
386+
) -> result!(V) {
387+
match binder {
388+
ClosureBinder::NotPresent => {}
389+
ClosureBinder::For { generic_params, span } => {
390+
visit_list!(vis, visit_generic_param, flat_map_generic_param, generic_params);
391+
try_v!(visit_span!(vis, span));
392+
}
393+
}
394+
return_result!(V)
395+
}
396+
383397
pub fn walk_fn_ret_ty<$($lt,)? V: $trait$(<$lt>)?>(
384398
vis: &mut V,
385399
ret_ty: ref_t!(FnRetTy)
@@ -1058,19 +1072,6 @@ pub mod visit {
10581072
V::Result::output()
10591073
}
10601074

1061-
pub fn walk_closure_binder<'a, V: Visitor<'a>>(
1062-
visitor: &mut V,
1063-
binder: &'a ClosureBinder,
1064-
) -> V::Result {
1065-
match binder {
1066-
ClosureBinder::NotPresent => {}
1067-
ClosureBinder::For { generic_params, span: _ } => {
1068-
walk_list!(visitor, visit_generic_param, generic_params)
1069-
}
1070-
}
1071-
V::Result::output()
1072-
}
1073-
10741075
pub fn walk_where_predicate<'a, V: Visitor<'a>>(
10751076
visitor: &mut V,
10761077
predicate: &'a WherePredicate,
@@ -2055,15 +2056,6 @@ pub mod mut_visit {
20552056
}
20562057
}
20572058

2058-
fn walk_closure_binder<T: MutVisitor>(vis: &mut T, binder: &mut ClosureBinder) {
2059-
match binder {
2060-
ClosureBinder::NotPresent => {}
2061-
ClosureBinder::For { span: _, generic_params } => {
2062-
generic_params.flat_map_in_place(|param| vis.flat_map_generic_param(param));
2063-
}
2064-
}
2065-
}
2066-
20672059
fn walk_coroutine_kind<T: MutVisitor>(vis: &mut T, coroutine_kind: &mut CoroutineKind) {
20682060
match coroutine_kind {
20692061
CoroutineKind::Async { span, closure_id, return_impl_trait_id }

0 commit comments

Comments
 (0)