@@ -233,10 +233,7 @@ ExpandVisitor::expand_inner_items (
233
233
}
234
234
}
235
235
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);
240
237
241
238
expander.pop_context ();
242
239
}
@@ -324,10 +321,7 @@ ExpandVisitor::expand_inner_stmts (AST::BlockExpr &expr)
324
321
if (!expr.has_tail_expr ())
325
322
expr.normalize_tail_expr ();
326
323
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);
331
325
332
326
expander.pop_context ();
333
327
}
@@ -866,12 +860,9 @@ ExpandVisitor::visit (AST::Trait &trait)
866
860
867
861
expander.push_context (MacroExpander::ContextType::TRAIT);
868
862
869
- std::function<std::unique_ptr<AST::AssociatedItem> (AST::SingleASTNode)>
870
- extractor
871
- = [] (AST::SingleASTNode node) { return node.take_assoc_item (); };
872
-
873
863
expand_macro_children (MacroExpander::ContextType::TRAIT,
874
- trait.get_trait_items (), extractor);
864
+ trait.get_trait_items (),
865
+ &AST::SingleASTNode::take_assoc_item);
875
866
876
867
expander.pop_context ();
877
868
}
@@ -894,12 +885,9 @@ ExpandVisitor::visit (AST::InherentImpl &impl)
894
885
if (impl.has_where_clause ())
895
886
expand_where_clause (impl.get_where_clause ());
896
887
897
- std::function<std::unique_ptr<AST::AssociatedItem> (AST::SingleASTNode)>
898
- extractor
899
- = [] (AST::SingleASTNode node) { return node.take_assoc_item (); };
900
-
901
888
expand_macro_children (MacroExpander::ContextType::IMPL,
902
- impl.get_impl_items (), extractor);
889
+ impl.get_impl_items (),
890
+ &AST::SingleASTNode::take_assoc_item);
903
891
}
904
892
905
893
void
@@ -922,12 +910,9 @@ ExpandVisitor::visit (AST::TraitImpl &impl)
922
910
if (impl.has_where_clause ())
923
911
expand_where_clause (impl.get_where_clause ());
924
912
925
- std::function<std::unique_ptr<AST::AssociatedItem> (AST::SingleASTNode)>
926
- extractor
927
- = [] (AST::SingleASTNode node) { return node.take_assoc_item (); };
928
-
929
913
expand_macro_children (MacroExpander::ContextType::TRAIT_IMPL,
930
- impl.get_impl_items (), extractor);
914
+ impl.get_impl_items (),
915
+ &AST::SingleASTNode::take_assoc_item);
931
916
}
932
917
933
918
void
@@ -944,12 +929,10 @@ void
944
929
ExpandVisitor::visit (AST::ExternBlock &block)
945
930
{
946
931
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 (); };
950
932
951
933
expand_macro_children (MacroExpander::ContextType::EXTERN,
952
- block.get_extern_items (), extractor);
934
+ block.get_extern_items (),
935
+ &AST::SingleASTNode::take_external_item);
953
936
}
954
937
955
938
void
0 commit comments