about summary refs log tree commit diff
path: root/src/libsyntax/ext/pipes/ast_builder.rs
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2013-03-01 19:38:39 -0500
committerNiko Matsakis <niko@alum.mit.edu>2013-03-01 19:58:17 -0500
commitca9549bdfc3dd969e9182d58038f90bbef026ded (patch)
treed66509b54f56151513e8207da875cb4e7df9ec85 /src/libsyntax/ext/pipes/ast_builder.rs
parent50c08dbf0d0150de41fcc7f5e87a97c4ea2bd4f0 (diff)
downloadrust-ca9549bdfc3dd969e9182d58038f90bbef026ded.tar.gz
rust-ca9549bdfc3dd969e9182d58038f90bbef026ded.zip
Avoid calling to_vec() unnecessarily in parser.
Also, rename the OptVec-to-vector conversion method to
opt_vec::take_vec() and convert from a method into a fn
because I fear strange bugs.
Diffstat (limited to 'src/libsyntax/ext/pipes/ast_builder.rs')
-rw-r--r--src/libsyntax/ext/pipes/ast_builder.rs10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/libsyntax/ext/pipes/ast_builder.rs b/src/libsyntax/ext/pipes/ast_builder.rs
index 3e6dedb3b31..6e1406e3647 100644
--- a/src/libsyntax/ext/pipes/ast_builder.rs
+++ b/src/libsyntax/ext/pipes/ast_builder.rs
@@ -394,13 +394,15 @@ impl ext_ctxt_ast_builder for ext_ctxt {
     }
 
     fn ty_vars(&self, ty_params: &OptVec<ast::TyParam>) -> ~[@ast::Ty] {
-        ty_params.map(|p| self.ty_path_ast_builder(
-            path(~[p.ident], dummy_sp()))).to_vec()
+        opt_vec::take_vec(
+            ty_params.map(|p| self.ty_path_ast_builder(
+                path(~[p.ident], dummy_sp()))))
     }
 
     fn ty_vars_global(&self,
                       ty_params: &OptVec<ast::TyParam>) -> ~[@ast::Ty] {
-        ty_params.map(|p| self.ty_path_ast_builder(
-            path(~[p.ident], dummy_sp()))).to_vec()
+        opt_vec::take_vec(
+            ty_params.map(|p| self.ty_path_ast_builder(
+                path(~[p.ident], dummy_sp()))))
     }
 }