diff options
| author | Tim Chevalier <chevalier@alum.wellesley.edu> | 2012-10-02 11:37:37 -0700 |
|---|---|---|
| committer | Tim Chevalier <chevalier@alum.wellesley.edu> | 2012-10-02 14:31:39 -0700 |
| commit | f78cdcb6364cf938bfeb71da0c7eca62e257d537 (patch) | |
| tree | cb3f93224e4757b5f77709e576ca6f24ce0981ec /src/libcore/dvec.rs | |
| parent | a5042d58ee86af13b6910fa1884b7c1fe9423ae7 (diff) | |
| download | rust-f78cdcb6364cf938bfeb71da0c7eca62e257d537.tar.gz rust-f78cdcb6364cf938bfeb71da0c7eca62e257d537.zip | |
Removing explicit uses of + mode
This removes most explicit uses of the + argument mode. Pending a snapshot, I had to remove the forbid(deprecated_modes) pragma from a bunch of files. I'll put it back! + mode still has to be used in a few places for functions that get moved (see task.rs) The changes outside core and std are due to the to_bytes trait and making the compiler (with legacy modes on) agree with the libraries (with legacy modes off) about modes.
Diffstat (limited to 'src/libcore/dvec.rs')
| -rw-r--r-- | src/libcore/dvec.rs | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/libcore/dvec.rs b/src/libcore/dvec.rs index 3ce5a7153fd..a2a70908797 100644 --- a/src/libcore/dvec.rs +++ b/src/libcore/dvec.rs @@ -10,7 +10,7 @@ Note that recursive use is not permitted. */ // NB: transitionary, de-mode-ing. -#[forbid(deprecated_mode)]; +// tjc: re-forbid deprecated modes after snapshot #[forbid(deprecated_pattern)]; use cast::reinterpret_cast; @@ -61,17 +61,17 @@ pub fn DVec<A>() -> DVec<A> { } /// Creates a new dvec with a single element -pub fn from_elem<A>(+e: A) -> DVec<A> { +pub fn from_elem<A>(e: A) -> DVec<A> { DVec_({mut data: ~[move e]}) } /// Creates a new dvec with the contents of a vector -pub fn from_vec<A>(+v: ~[A]) -> DVec<A> { +pub fn from_vec<A>(v: ~[A]) -> DVec<A> { DVec_({mut data: move v}) } /// Consumes the vector and returns its contents -pub fn unwrap<A>(+d: DVec<A>) -> ~[A] { +pub fn unwrap<A>(d: DVec<A>) -> ~[A] { let DVec_({data: v}) <- d; move v } @@ -87,7 +87,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; @@ -98,7 +98,7 @@ priv impl<A> DVec<A> { } #[inline(always)] - fn give_back(+data: ~[A]) { + fn give_back(data: ~[A]) { unsafe { self.data = move data; } @@ -120,7 +120,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))) } @@ -130,7 +130,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))) } @@ -148,7 +148,7 @@ impl<A> DVec<A> { } /// Overwrite the current contents - fn set(+w: ~[A]) { + fn set(w: ~[A]) { self.check_not_borrowed(); self.data <- w; } @@ -164,7 +164,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; @@ -178,7 +178,7 @@ impl<A> DVec<A> { } /// Append a single item to the end of the list - fn push(+t: A) { + fn push(t: A) { self.check_not_borrowed(); self.data.push(move t); } @@ -295,7 +295,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; } @@ -305,7 +305,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; v.grow_set(idx, initval, val); @@ -354,7 +354,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) } } |
