Rollup merge of #124382 - petrochenkov:itemvisit, r=lcnr
ast: Generalize item kind visiting And avoid duplicating logic for visiting `Item`s with different kinds (regular, associated, foreign). The diff is better viewed with whitespace ignored.
This commit is contained in:
commit
cf07246ae9
18 changed files with 413 additions and 385 deletions
|
@ -1218,7 +1218,7 @@ impl InvocationCollectorNode for AstNodeWrapper<P<ast::AssocItem>, TraitItemTag>
|
|||
fragment.make_trait_items()
|
||||
}
|
||||
fn noop_flat_map<V: MutVisitor>(self, visitor: &mut V) -> Self::OutputTy {
|
||||
noop_flat_map_assoc_item(self.wrapped, visitor)
|
||||
noop_flat_map_item(self.wrapped, visitor)
|
||||
}
|
||||
fn is_mac_call(&self) -> bool {
|
||||
matches!(self.wrapped.kind, AssocItemKind::MacCall(..))
|
||||
|
@ -1243,7 +1243,7 @@ impl InvocationCollectorNode for AstNodeWrapper<P<ast::AssocItem>, ImplItemTag>
|
|||
fragment.make_impl_items()
|
||||
}
|
||||
fn noop_flat_map<V: MutVisitor>(self, visitor: &mut V) -> Self::OutputTy {
|
||||
noop_flat_map_assoc_item(self.wrapped, visitor)
|
||||
noop_flat_map_item(self.wrapped, visitor)
|
||||
}
|
||||
fn is_mac_call(&self) -> bool {
|
||||
matches!(self.wrapped.kind, AssocItemKind::MacCall(..))
|
||||
|
@ -1266,7 +1266,7 @@ impl InvocationCollectorNode for P<ast::ForeignItem> {
|
|||
fragment.make_foreign_items()
|
||||
}
|
||||
fn noop_flat_map<V: MutVisitor>(self, visitor: &mut V) -> Self::OutputTy {
|
||||
noop_flat_map_foreign_item(self, visitor)
|
||||
noop_flat_map_item(self, visitor)
|
||||
}
|
||||
fn is_mac_call(&self) -> bool {
|
||||
matches!(self.kind, ForeignItemKind::MacCall(..))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue