From a7ecde33238f46ae473ceb63db95068f1ce6cffd Mon Sep 17 00:00:00 2001 From: Erick Tryzelaar Date: Thu, 18 Oct 2012 09:14:11 -0700 Subject: libcore: minor code cleanup. This is minor and probably completely inconsequential to performance, but I find vec::map to be more clear than vec::each and a push. --- src/libsyntax/attr.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src/libsyntax') diff --git a/src/libsyntax/attr.rs b/src/libsyntax/attr.rs index d08edd7af1d..4bd1679600f 100644 --- a/src/libsyntax/attr.rs +++ b/src/libsyntax/attr.rs @@ -90,9 +90,7 @@ fn attr_meta(attr: ast::attribute) -> @ast::meta_item { @attr.node.value } // Get the meta_items from inside a vector of attributes fn attr_metas(attrs: ~[ast::attribute]) -> ~[@ast::meta_item] { - let mut mitems = ~[]; - for attrs.each |a| { mitems.push(attr_meta(*a)); } - return mitems; + do attrs.map |a| { attr_meta(*a) } } fn desugar_doc_attr(attr: &ast::attribute) -> ast::attribute { -- cgit 1.4.1-3-g733a5