@@ -233,10 +233,7 @@ ExpandVisitor::expand_inner_items (
233233 }
234234 }
235235
236- std::function<std::unique_ptr<AST::Item> (AST::SingleASTNode)> extractor
237- = [] (AST::SingleASTNode node) { return node.take_item (); };
238-
239- expand_macro_children (items, extractor);
236+ expand_macro_children (items, &AST::SingleASTNode::take_item);
240237
241238 expander.pop_context ();
242239}
@@ -324,10 +321,7 @@ ExpandVisitor::expand_inner_stmts (AST::BlockExpr &expr)
324321 if (!expr.has_tail_expr ())
325322 expr.normalize_tail_expr ();
326323
327- std::function<std::unique_ptr<AST::Stmt> (AST::SingleASTNode)> extractor
328- = [] (AST::SingleASTNode node) { return node.take_stmt (); };
329-
330- expand_macro_children (stmts, extractor);
324+ expand_macro_children (stmts, &AST::SingleASTNode::take_stmt);
331325
332326 expander.pop_context ();
333327}
@@ -866,12 +860,9 @@ ExpandVisitor::visit (AST::Trait &trait)
866860
867861 expander.push_context (MacroExpander::ContextType::TRAIT);
868862
869- std::function<std::unique_ptr<AST::AssociatedItem> (AST::SingleASTNode)>
870- extractor
871- = [] (AST::SingleASTNode node) { return node.take_assoc_item (); };
872-
873863 expand_macro_children (MacroExpander::ContextType::TRAIT,
874- trait.get_trait_items (), extractor);
864+ trait.get_trait_items (),
865+ &AST::SingleASTNode::take_assoc_item);
875866
876867 expander.pop_context ();
877868}
@@ -894,12 +885,9 @@ ExpandVisitor::visit (AST::InherentImpl &impl)
894885 if (impl.has_where_clause ())
895886 expand_where_clause (impl.get_where_clause ());
896887
897- std::function<std::unique_ptr<AST::AssociatedItem> (AST::SingleASTNode)>
898- extractor
899- = [] (AST::SingleASTNode node) { return node.take_assoc_item (); };
900-
901888 expand_macro_children (MacroExpander::ContextType::IMPL,
902- impl.get_impl_items (), extractor);
889+ impl.get_impl_items (),
890+ &AST::SingleASTNode::take_assoc_item);
903891}
904892
905893void
@@ -922,12 +910,9 @@ ExpandVisitor::visit (AST::TraitImpl &impl)
922910 if (impl.has_where_clause ())
923911 expand_where_clause (impl.get_where_clause ());
924912
925- std::function<std::unique_ptr<AST::AssociatedItem> (AST::SingleASTNode)>
926- extractor
927- = [] (AST::SingleASTNode node) { return node.take_assoc_item (); };
928-
929913 expand_macro_children (MacroExpander::ContextType::TRAIT_IMPL,
930- impl.get_impl_items (), extractor);
914+ impl.get_impl_items (),
915+ &AST::SingleASTNode::take_assoc_item);
931916}
932917
933918void
@@ -944,12 +929,10 @@ void
944929ExpandVisitor::visit (AST::ExternBlock &block)
945930{
946931 visit_inner_attrs (block);
947- std::function<std::unique_ptr<AST::ExternalItem> (AST::SingleASTNode)>
948- extractor
949- = [] (AST::SingleASTNode node) { return node.take_external_item (); };
950932
951933 expand_macro_children (MacroExpander::ContextType::EXTERN,
952- block.get_extern_items (), extractor);
934+ block.get_extern_items (),
935+ &AST::SingleASTNode::take_external_item);
953936}
954937
955938void
0 commit comments