summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2012-09-26 18:12:07 -0700
committerBrian Anderson <banderson@mozilla.com>2012-09-26 19:12:32 -0700
commit0ec267b276d85786f4529e3d9717c6594bbf2f1d (patch)
tree054628d25357f6774bba2f836a67176289514054 /src/libstd
parent5424f21d5dd054e57113ca7814b813ba2d09fa15 (diff)
downloadrust-0ec267b276d85786f4529e3d9717c6594bbf2f1d.tar.gz
rust-0ec267b276d85786f4529e3d9717c6594bbf2f1d.zip
std: Demode more of list and treemap
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/arena.rs2
-rw-r--r--src/libstd/list.rs6
-rw-r--r--src/libstd/treemap.rs6
3 files changed, 7 insertions, 7 deletions
diff --git a/src/libstd/arena.rs b/src/libstd/arena.rs
index f9c023597c4..fbe9a2ddae6 100644
--- a/src/libstd/arena.rs
+++ b/src/libstd/arena.rs
@@ -63,7 +63,7 @@ struct Arena {
         unsafe {
             destroy_chunk(&self.head);
             for list::each(self.chunks) |chunk| {
-                if !chunk.is_pod { destroy_chunk(&chunk); }
+                if !chunk.is_pod { destroy_chunk(chunk); }
             }
         }
     }
diff --git a/src/libstd/list.rs b/src/libstd/list.rs
index 297720cbde9..d8f7edada6a 100644
--- a/src/libstd/list.rs
+++ b/src/libstd/list.rs
@@ -59,7 +59,7 @@ fn find<T: Copy>(ls: @List<T>, f: fn((&T)) -> bool) -> Option<T> {
 /// Returns true if a list contains an element with the given value
 fn has<T: Copy Eq>(ls: @List<T>, +elt: T) -> bool {
     for each(ls) |e| {
-        if e == elt { return true; }
+        if *e == elt { return true; }
     }
     return false;
 }
@@ -135,11 +135,11 @@ fn iter<T>(l: @List<T>, f: fn((&T))) {
 }
 
 /// Iterate over a list
-fn each<T>(l: @List<T>, f: fn(T) -> bool) {
+fn each<T>(l: @List<T>, f: fn((&T)) -> bool) {
     let mut cur = l;
     loop {
         cur = match *cur {
-          Cons(hd, tl) => {
+          Cons(ref hd, tl) => {
             if !f(hd) { return; }
             tl
           }
diff --git a/src/libstd/treemap.rs b/src/libstd/treemap.rs
index d6946590d80..7fe8b145ed7 100644
--- a/src/libstd/treemap.rs
+++ b/src/libstd/treemap.rs
@@ -73,13 +73,13 @@ fn find<K: Copy Eq Ord, V: Copy>(m: &const TreeEdge<K, V>, +k: K)
 }
 
 /// Visit all pairs in the map in order.
-fn traverse<K, V: Copy>(m: &const TreeEdge<K, V>, f: fn(K, V)) {
+fn traverse<K, V: Copy>(m: &const TreeEdge<K, V>, f: fn((&K), (&V))) {
     match copy *m {
       None => (),
       Some(node) => {
         traverse(&const node.left, f);
         // copy of value is req'd as f() requires an immutable ptr
-        f(node.key, copy node.value);
+        f(&node.key, &copy node.value);
         traverse(&const node.right, f);
       }
     }
@@ -130,7 +130,7 @@ mod tests {
         fn t(n: @mut int, +k: int, +_v: ()) {
             assert (*n == k); *n += 1;
         }
-        traverse(m, |x,y| t(n, x, y));
+        traverse(m, |x,y| t(n, *x, *y));
     }
 
     #[test]