Auto merge of #101709 - nnethercote:simplify-visitors-more, r=cjgillot
Simplify visitors more A successor to #100392. r? `@cjgillot`
This commit is contained in:
commit
a0d1df4a5d
26 changed files with 115 additions and 156 deletions
|
@ -223,11 +223,9 @@ impl<'a> AstValidator<'a> {
|
|||
for (i, segment) in path.segments.iter().enumerate() {
|
||||
// Allow `impl Trait` iff we're on the final path segment
|
||||
if i == path.segments.len() - 1 {
|
||||
self.visit_path_segment(path.span, segment);
|
||||
self.visit_path_segment(segment);
|
||||
} else {
|
||||
self.with_banned_impl_trait(|this| {
|
||||
this.visit_path_segment(path.span, segment)
|
||||
});
|
||||
self.with_banned_impl_trait(|this| this.visit_path_segment(segment));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1293,7 +1291,7 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
|
|||
}
|
||||
|
||||
// Mirrors `visit::walk_generic_args`, but tracks relevant state.
|
||||
fn visit_generic_args(&mut self, _: Span, generic_args: &'a GenericArgs) {
|
||||
fn visit_generic_args(&mut self, generic_args: &'a GenericArgs) {
|
||||
match *generic_args {
|
||||
GenericArgs::AngleBracketed(ref data) => {
|
||||
self.check_generic_args_before_constraints(data);
|
||||
|
@ -1529,7 +1527,7 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
|
|||
matches!(fk.header(), Some(FnHeader { constness: Const::Yes(_), .. }))
|
||||
|| matches!(fk.ctxt(), Some(FnCtxt::Assoc(_)));
|
||||
|
||||
self.with_tilde_const(tilde_const_allowed, |this| visit::walk_fn(this, fk, span));
|
||||
self.with_tilde_const(tilde_const_allowed, |this| visit::walk_fn(this, fk));
|
||||
}
|
||||
|
||||
fn visit_assoc_item(&mut self, item: &'a AssocItem, ctxt: AssocCtxt) {
|
||||
|
|
|
@ -680,7 +680,7 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
|
|||
gate_feature_post!(&self, c_variadic, span, "C-variadic functions are unstable");
|
||||
}
|
||||
|
||||
visit::walk_fn(self, fn_kind, span)
|
||||
visit::walk_fn(self, fn_kind)
|
||||
}
|
||||
|
||||
fn visit_assoc_constraint(&mut self, constraint: &'a AssocConstraint) {
|
||||
|
|
|
@ -63,9 +63,9 @@ impl<'ast> Visitor<'ast> for NodeCounter {
|
|||
self.count += 1;
|
||||
walk_generics(self, g)
|
||||
}
|
||||
fn visit_fn(&mut self, fk: visit::FnKind<'_>, s: Span, _: NodeId) {
|
||||
fn visit_fn(&mut self, fk: visit::FnKind<'_>, _: Span, _: NodeId) {
|
||||
self.count += 1;
|
||||
walk_fn(self, fk, s)
|
||||
walk_fn(self, fk)
|
||||
}
|
||||
fn visit_assoc_item(&mut self, ti: &AssocItem, ctxt: AssocCtxt) {
|
||||
self.count += 1;
|
||||
|
@ -115,9 +115,9 @@ impl<'ast> Visitor<'ast> for NodeCounter {
|
|||
self.count += 1;
|
||||
walk_use_tree(self, use_tree, id)
|
||||
}
|
||||
fn visit_generic_args(&mut self, path_span: Span, generic_args: &GenericArgs) {
|
||||
fn visit_generic_args(&mut self, generic_args: &GenericArgs) {
|
||||
self.count += 1;
|
||||
walk_generic_args(self, path_span, generic_args)
|
||||
walk_generic_args(self, generic_args)
|
||||
}
|
||||
fn visit_assoc_constraint(&mut self, constraint: &AssocConstraint) {
|
||||
self.count += 1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue