about summary refs log tree commit diff
path: root/src/libcore/dvec.rs
diff options
context:
space:
mode:
authorTim Chevalier <chevalier@alum.wellesley.edu>2012-09-25 18:27:45 -0700
committerTim Chevalier <chevalier@alum.wellesley.edu>2012-09-25 18:27:55 -0700
commit3023bd872949ce4ba45e13dbcd30d6b98963d0ed (patch)
treece41435fb14227e5baadb6cb8d0a9f738077ea12 /src/libcore/dvec.rs
parentab6318803e1764e6e894441c2829f9b47acbf298 (diff)
Demode dvec
Diffstat (limited to 'src/libcore/dvec.rs')
-rw-r--r--src/libcore/dvec.rs18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/libcore/dvec.rs b/src/libcore/dvec.rs
index 82767112b39..008d7841bec 100644
--- a/src/libcore/dvec.rs
+++ b/src/libcore/dvec.rs
@@ -93,7 +93,7 @@ priv impl<A> DVec<A> {
     }
 
     #[inline(always)]
-    fn check_out<B>(f: fn(-v: ~[A]) -> B) -> B {
+    fn check_out<B>(f: &fn(+v: ~[A]) -> B) -> B {
         unsafe {
             let mut data = cast::reinterpret_cast(&null::<()>());
             data <-> self.data;
@@ -126,7 +126,7 @@ impl<A> DVec<A> {
      * and return a new vector to replace it with.
      */
     #[inline(always)]
-    fn swap(f: fn(-v: ~[A]) -> ~[A]) {
+    fn swap(f: &fn(+v: ~[A]) -> ~[A]) {
         self.check_out(|v| self.give_back(f(move v)))
     }
 
@@ -136,7 +136,7 @@ impl<A> DVec<A> {
      * and return a new vector to replace it with.
      */
     #[inline(always)]
-    fn swap_mut(f: fn(-v: ~[mut A]) -> ~[mut A]) {
+    fn swap_mut(f: &fn(-v: ~[mut A]) -> ~[mut A]) {
         do self.swap |v| {
             vec::from_mut(f(vec::to_mut(move v)))
         }
@@ -170,7 +170,7 @@ impl<A> DVec<A> {
     }
 
     /// Insert a single item at the front of the list
-    fn unshift(-t: A) {
+    fn unshift(+t: A) {
         unsafe {
             let mut data = cast::reinterpret_cast(&null::<()>());
             data <-> self.data;
@@ -301,7 +301,7 @@ impl<A: Copy> DVec<A> {
     }
 
     /// Overwrites the contents of the element at `idx` with `a`
-    fn set_elt(idx: uint, a: A) {
+    fn set_elt(idx: uint, +a: A) {
         self.check_not_borrowed();
         self.data[idx] = a;
     }
@@ -311,7 +311,7 @@ impl<A: Copy> DVec<A> {
      * growing the vector if necessary.  New elements will be initialized
      * with `initval`
      */
-    fn grow_set_elt(idx: uint, initval: A, val: A) {
+    fn grow_set_elt(idx: uint, initval: A, +val: A) {
         do self.swap |v| {
             let mut v = move v;
             vec::grow_set(v, idx, initval, val);
@@ -325,11 +325,11 @@ impl<A: Copy> DVec<A> {
         self.check_not_borrowed();
 
         let length = self.len();
-        if length == 0u {
+        if length == 0 {
             fail ~"attempt to retrieve the last element of an empty vector";
         }
 
-        return self.data[length - 1u];
+        return self.data[length - 1];
     }
 
     /// Iterates over the elements in reverse order
@@ -360,7 +360,7 @@ impl<A: Copy> DVec<A> {
 }
 
 impl<A:Copy> DVec<A>: Index<uint,A> {
-    pure fn index(&&idx: uint) -> A {
+    pure fn index(+idx: uint) -> A {
         self.get_elt(idx)
     }
 }