about summary refs log tree commit diff
path: root/src/libcore/dvec.rs
diff options
context:
space:
mode:
authorEric Holk <eric.holk@gmail.com>2012-06-14 11:38:45 -0700
committerEric Holk <eric.holk@gmail.com>2012-06-21 16:11:11 -0700
commit9bdb2c9e48cefc684b6163249ca816cd96350bde (patch)
treea1f34c68a5490f86915133815c1bbf8d20de88c6 /src/libcore/dvec.rs
parent0e5cfd9f339c78384ef3fbcb4d230fa0bb363d54 (diff)
Library vecs are fast now.
Diffstat (limited to 'src/libcore/dvec.rs')
-rw-r--r--src/libcore/dvec.rs8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/libcore/dvec.rs b/src/libcore/dvec.rs
index ef368fe7a8b..d30179fd881 100644
--- a/src/libcore/dvec.rs
+++ b/src/libcore/dvec.rs
@@ -113,6 +113,7 @@ impl extensions<A> for dvec<A> {
     and return a new vector to replace it with.
 
     "]
+    #[inline(always)]
     fn swap(f: fn(-[mut A]) -> [mut A]) {
         self.borrow { |v| self.return(f(v)) }
     }
@@ -136,11 +137,8 @@ impl extensions<A> for dvec<A> {
 impl extensions<A:copy> for dvec<A> {
     #[doc = "Append a single item to the end of the list"]
     fn push(t: A) {
-        self.swap { |v|
-            let mut v <- v;
-            vec::push(v, t);
-            v
-        }
+        self.check_not_borrowed();
+        vec::push(self.data, t);
     }
 
     #[doc = "Remove and return the last element"]