This commit is contained in:
maxcabrajac 2024-11-17 19:49:29 -03:00
parent eb2f1c85b3
commit 5c2de73700

View File

@ -335,6 +335,10 @@ pub trait MutVisitor: Sized {
// Do nothing. // Do nothing.
} }
fn visit_pat_field(&mut self, fp: &mut PatField) {
walk_pat_field(self, fp)
}
fn flat_map_pat_field(&mut self, fp: PatField) -> SmallVec<[PatField; 1]> { fn flat_map_pat_field(&mut self, fp: PatField) -> SmallVec<[PatField; 1]> {
walk_flat_map_pat_field(self, fp) walk_flat_map_pat_field(self, fp)
} }
@ -449,16 +453,20 @@ pub fn visit_delim_span<T: MutVisitor>(vis: &mut T, DelimSpan { open, close }: &
vis.visit_span(close); vis.visit_span(close);
} }
pub fn walk_flat_map_pat_field<T: MutVisitor>( pub fn walk_pat_field<T: MutVisitor>(vis: &mut T, fp: &mut PatField) {
vis: &mut T, let PatField { attrs, id, ident, is_placeholder: _, is_shorthand: _, pat, span } = fp;
mut fp: PatField,
) -> SmallVec<[PatField; 1]> {
let PatField { attrs, id, ident, is_placeholder: _, is_shorthand: _, pat, span } = &mut fp;
vis.visit_id(id); vis.visit_id(id);
visit_attrs(vis, attrs); visit_attrs(vis, attrs);
vis.visit_ident(ident); vis.visit_ident(ident);
vis.visit_pat(pat); vis.visit_pat(pat);
vis.visit_span(span); vis.visit_span(span);
}
pub fn walk_flat_map_pat_field<T: MutVisitor>(
vis: &mut T,
mut fp: PatField,
) -> SmallVec<[PatField; 1]> {
vis.visit_pat_field(&mut fp);
smallvec![fp] smallvec![fp]
} }