Avoid passing state that will not be visited
This commit is contained in:
parent
91b26fcb89
commit
e9f32d0ca6
5 changed files with 29 additions and 66 deletions
|
@ -1149,7 +1149,7 @@ impl InvocationCollectorNode for P<ast::Item> {
|
|||
fragment.make_items()
|
||||
}
|
||||
fn walk_flat_map<V: MutVisitor>(self, visitor: &mut V) -> Self::OutputTy {
|
||||
walk_flat_map_item(visitor, self, None)
|
||||
walk_flat_map_item(visitor, self)
|
||||
}
|
||||
fn is_mac_call(&self) -> bool {
|
||||
matches!(self.kind, ItemKind::MacCall(..))
|
||||
|
@ -1293,7 +1293,7 @@ impl InvocationCollectorNode for AstNodeWrapper<P<ast::AssocItem>, TraitItemTag>
|
|||
fragment.make_trait_items()
|
||||
}
|
||||
fn walk_flat_map<V: MutVisitor>(self, visitor: &mut V) -> Self::OutputTy {
|
||||
walk_flat_map_item(visitor, self.wrapped, Some(AssocCtxt::Trait))
|
||||
walk_flat_map_item(visitor, self.wrapped)
|
||||
}
|
||||
fn is_mac_call(&self) -> bool {
|
||||
matches!(self.wrapped.kind, AssocItemKind::MacCall(..))
|
||||
|
@ -1334,7 +1334,7 @@ impl InvocationCollectorNode for AstNodeWrapper<P<ast::AssocItem>, ImplItemTag>
|
|||
fragment.make_impl_items()
|
||||
}
|
||||
fn walk_flat_map<V: MutVisitor>(self, visitor: &mut V) -> Self::OutputTy {
|
||||
walk_flat_map_item(visitor, self.wrapped, Some(AssocCtxt::Impl))
|
||||
walk_flat_map_item(visitor, self.wrapped)
|
||||
}
|
||||
fn is_mac_call(&self) -> bool {
|
||||
matches!(self.wrapped.kind, AssocItemKind::MacCall(..))
|
||||
|
@ -1372,7 +1372,7 @@ impl InvocationCollectorNode for P<ast::ForeignItem> {
|
|||
fragment.make_foreign_items()
|
||||
}
|
||||
fn walk_flat_map<V: MutVisitor>(self, visitor: &mut V) -> Self::OutputTy {
|
||||
walk_flat_map_item(visitor, self, None)
|
||||
walk_flat_map_item(visitor, self)
|
||||
}
|
||||
fn is_mac_call(&self) -> bool {
|
||||
matches!(self.kind, ForeignItemKind::MacCall(..))
|
||||
|
|
|
@ -267,7 +267,7 @@ impl MutVisitor for PlaceholderExpander {
|
|||
fn flat_map_item(&mut self, item: P<ast::Item>) -> SmallVec<[P<ast::Item>; 1]> {
|
||||
match item.kind {
|
||||
ast::ItemKind::MacCall(_) => self.remove(item.id).make_items(),
|
||||
_ => walk_flat_map_item(self, item, None),
|
||||
_ => walk_flat_map_item(self, item),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -284,7 +284,7 @@ impl MutVisitor for PlaceholderExpander {
|
|||
AssocCtxt::Impl => it.make_impl_items(),
|
||||
}
|
||||
}
|
||||
_ => walk_flat_map_item(self, item, Some(ctxt)),
|
||||
_ => walk_flat_map_item(self, item),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -294,7 +294,7 @@ impl MutVisitor for PlaceholderExpander {
|
|||
) -> SmallVec<[P<ast::ForeignItem>; 1]> {
|
||||
match item.kind {
|
||||
ast::ForeignItemKind::MacCall(_) => self.remove(item.id).make_foreign_items(),
|
||||
_ => walk_flat_map_item(self, item, None),
|
||||
_ => walk_flat_map_item(self, item),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue