Skip to content

Commit 0ec267b

Browse files
committed
std: Demode more of list and treemap
1 parent 5424f21 commit 0ec267b

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

src/libstd/arena.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ struct Arena {
6363
unsafe {
6464
destroy_chunk(&self.head);
6565
for list::each(self.chunks) |chunk| {
66-
if !chunk.is_pod { destroy_chunk(&chunk); }
66+
if !chunk.is_pod { destroy_chunk(chunk); }
6767
}
6868
}
6969
}

src/libstd/list.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ fn find<T: Copy>(ls: @List<T>, f: fn((&T)) -> bool) -> Option<T> {
5959
/// Returns true if a list contains an element with the given value
6060
fn has<T: Copy Eq>(ls: @List<T>, +elt: T) -> bool {
6161
for each(ls) |e| {
62-
if e == elt { return true; }
62+
if *e == elt { return true; }
6363
}
6464
return false;
6565
}
@@ -135,11 +135,11 @@ fn iter<T>(l: @List<T>, f: fn((&T))) {
135135
}
136136

137137
/// Iterate over a list
138-
fn each<T>(l: @List<T>, f: fn(T) -> bool) {
138+
fn each<T>(l: @List<T>, f: fn((&T)) -> bool) {
139139
let mut cur = l;
140140
loop {
141141
cur = match *cur {
142-
Cons(hd, tl) => {
142+
Cons(ref hd, tl) => {
143143
if !f(hd) { return; }
144144
tl
145145
}

src/libstd/treemap.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,13 @@ fn find<K: Copy Eq Ord, V: Copy>(m: &const TreeEdge<K, V>, +k: K)
7373
}
7474

7575
/// Visit all pairs in the map in order.
76-
fn traverse<K, V: Copy>(m: &const TreeEdge<K, V>, f: fn(K, V)) {
76+
fn traverse<K, V: Copy>(m: &const TreeEdge<K, V>, f: fn((&K), (&V))) {
7777
match copy *m {
7878
None => (),
7979
Some(node) => {
8080
traverse(&const node.left, f);
8181
// copy of value is req'd as f() requires an immutable ptr
82-
f(node.key, copy node.value);
82+
f(&node.key, &copy node.value);
8383
traverse(&const node.right, f);
8484
}
8585
}
@@ -130,7 +130,7 @@ mod tests {
130130
fn t(n: @mut int, +k: int, +_v: ()) {
131131
assert (*n == k); *n += 1;
132132
}
133-
traverse(m, |x,y| t(n, x, y));
133+
traverse(m, |x,y| t(n, *x, *y));
134134
}
135135

136136
#[test]

src/rustc/middle/typeck/check.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ impl isr_alist: get_and_find_region {
181181

182182
fn find(br: ty::bound_region) -> Option<ty::region> {
183183
for list::each(self) |isr| {
184-
let (isr_br, isr_r) = isr;
184+
let (isr_br, isr_r) = *isr;
185185
if isr_br == br { return Some(isr_r); }
186186
}
187187
return None;

0 commit comments

Comments
 (0)