Skip to content

Commit 3023bd8

Browse files
committed
Demode dvec
1 parent ab63188 commit 3023bd8

File tree

8 files changed

+16
-16
lines changed

8 files changed

+16
-16
lines changed

src/libcore/dlist.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ fn concat<T>(lists: DList<DList<T>>) -> DList<T> {
118118
}
119119

120120
priv impl<T> DList<T> {
121-
pure fn new_link(-data: T) -> DListLink<T> {
121+
pure fn new_link(+data: T) -> DListLink<T> {
122122
Some(DListNode(@{data: move data, mut linked: true,
123123
mut prev: None, mut next: None}))
124124
}

src/libcore/dvec.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ priv impl<A> DVec<A> {
9393
}
9494

9595
#[inline(always)]
96-
fn check_out<B>(f: fn(-v: ~[A]) -> B) -> B {
96+
fn check_out<B>(f: &fn(+v: ~[A]) -> B) -> B {
9797
unsafe {
9898
let mut data = cast::reinterpret_cast(&null::<()>());
9999
data <-> self.data;
@@ -126,7 +126,7 @@ impl<A> DVec<A> {
126126
* and return a new vector to replace it with.
127127
*/
128128
#[inline(always)]
129-
fn swap(f: fn(-v: ~[A]) -> ~[A]) {
129+
fn swap(f: &fn(+v: ~[A]) -> ~[A]) {
130130
self.check_out(|v| self.give_back(f(move v)))
131131
}
132132

@@ -136,7 +136,7 @@ impl<A> DVec<A> {
136136
* and return a new vector to replace it with.
137137
*/
138138
#[inline(always)]
139-
fn swap_mut(f: fn(-v: ~[mut A]) -> ~[mut A]) {
139+
fn swap_mut(f: &fn(-v: ~[mut A]) -> ~[mut A]) {
140140
do self.swap |v| {
141141
vec::from_mut(f(vec::to_mut(move v)))
142142
}
@@ -170,7 +170,7 @@ impl<A> DVec<A> {
170170
}
171171

172172
/// Insert a single item at the front of the list
173-
fn unshift(-t: A) {
173+
fn unshift(+t: A) {
174174
unsafe {
175175
let mut data = cast::reinterpret_cast(&null::<()>());
176176
data <-> self.data;
@@ -301,7 +301,7 @@ impl<A: Copy> DVec<A> {
301301
}
302302
303303
/// Overwrites the contents of the element at `idx` with `a`
304-
fn set_elt(idx: uint, a: A) {
304+
fn set_elt(idx: uint, +a: A) {
305305
self.check_not_borrowed();
306306
self.data[idx] = a;
307307
}
@@ -311,7 +311,7 @@ impl<A: Copy> DVec<A> {
311311
* growing the vector if necessary. New elements will be initialized
312312
* with `initval`
313313
*/
314-
fn grow_set_elt(idx: uint, initval: A, val: A) {
314+
fn grow_set_elt(idx: uint, initval: A, +val: A) {
315315
do self.swap |v| {
316316
let mut v = move v;
317317
vec::grow_set(v, idx, initval, val);
@@ -325,11 +325,11 @@ impl<A: Copy> DVec<A> {
325325
self.check_not_borrowed();
326326
327327
let length = self.len();
328-
if length == 0u {
328+
if length == 0 {
329329
fail ~"attempt to retrieve the last element of an empty vector";
330330
}
331331

332-
return self.data[length - 1u];
332+
return self.data[length - 1];
333333
}
334334

335335
/// Iterates over the elements in reverse order
@@ -360,7 +360,7 @@ impl<A: Copy> DVec<A> {
360360
}
361361

362362
impl<A:Copy> DVec<A>: Index<uint,A> {
363-
pure fn index(&&idx: uint) -> A {
363+
pure fn index(+idx: uint) -> A {
364364
self.get_elt(idx)
365365
}
366366
}

src/libcore/ops.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,6 @@ trait Shr<RHS,Result> {
7777

7878
#[lang="index"]
7979
trait Index<Index,Result> {
80-
pure fn index(index: Index) -> Result;
80+
pure fn index(+index: Index) -> Result;
8181
}
8282

src/libstd/bitv.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,7 @@ pure fn land(w0: uint, w1: uint) -> uint { return w0 & w1; }
556556
pure fn right(_w0: uint, w1: uint) -> uint { return w1; }
557557

558558
impl Bitv: ops::Index<uint,bool> {
559-
pure fn index(&&i: uint) -> bool {
559+
pure fn index(+i: uint) -> bool {
560560
self.get(i)
561561
}
562562
}

src/libstd/ebml.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ type Doc = {data: @~[u8], start: uint, end: uint};
4242
type TaggedDoc = {tag: uint, doc: Doc};
4343

4444
impl Doc: ops::Index<uint,Doc> {
45-
pure fn index(&&tag: uint) -> Doc {
45+
pure fn index(+tag: uint) -> Doc {
4646
unsafe {
4747
get_doc(self, tag)
4848
}

src/libstd/map.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ mod chained {
356356
}
357357

358358
impl<K:Eq IterBytes Hash Copy, V: Copy> T<K, V>: ops::Index<K, V> {
359-
pure fn index(&&k: K) -> V {
359+
pure fn index(+k: K) -> V {
360360
unsafe {
361361
self.get(k)
362362
}

src/libstd/smallintmap.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ impl<V: Copy> SmallIntMap<V>: map::Map<uint, V> {
132132
}
133133

134134
impl<V: Copy> SmallIntMap<V>: ops::Index<uint, V> {
135-
pure fn index(&&key: uint) -> V {
135+
pure fn index(+key: uint) -> V {
136136
unsafe {
137137
get(self, key)
138138
}

src/test/run-pass/operator-overloading.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ impl Point : ops::Neg<Point> {
2525
}
2626

2727
impl Point : ops::Index<bool,int> {
28-
pure fn index(&&x: bool) -> int {
28+
pure fn index(+x: bool) -> int {
2929
if x { self.x } else { self.y }
3030
}
3131
}

0 commit comments

Comments
 (0)