about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorDaniel Micay <danielmicay@gmail.com>2013-02-10 16:30:17 -0500
committerDaniel Micay <danielmicay@gmail.com>2013-02-10 16:30:17 -0500
commit99ff74c1bd4d982cfc49f8ed962cd31f3c8d9ae7 (patch)
tree4dd716dd3ed42449f397cdebef5531376daa3244 /src
parent9d7014e55c06a184b02ccf724497c4c72d4d2041 (diff)
downloadrust-99ff74c1bd4d982cfc49f8ed962cd31f3c8d9ae7.tar.gz
rust-99ff74c1bd4d982cfc49f8ed962cd31f3c8d9ae7.zip
make Option's iter method use a lifetime
Diffstat (limited to 'src')
-rw-r--r--src/libcore/option.rs4
-rw-r--r--src/libstd/treemap.rs8
2 files changed, 6 insertions, 6 deletions
diff --git a/src/libcore/option.rs b/src/libcore/option.rs
index cfc2cba9226..c2af5f8b73b 100644
--- a/src/libcore/option.rs
+++ b/src/libcore/option.rs
@@ -201,7 +201,7 @@ pub pure fn map_default<T, U>(opt: &r/Option<T>, def: U,
 }
 
 #[inline(always)]
-pub pure fn iter<T>(opt: &Option<T>, f: fn(x: &T)) {
+pub pure fn iter<T>(opt: &r/Option<T>, f: fn(x: &r/T)) {
     //! Performs an operation on the contained value by reference
     match *opt { None => (), Some(ref t) => f(t) }
 }
@@ -313,7 +313,7 @@ impl<T> Option<T> {
 
     /// Performs an operation on the contained value by reference
     #[inline(always)]
-    pure fn iter(&self, f: fn(x: &T)) { iter(self, f) }
+    pure fn iter(&self, f: fn(x: &self/T)) { iter(self, f) }
 
     /**
     Gets an immutable reference to the value inside an option.
diff --git a/src/libstd/treemap.rs b/src/libstd/treemap.rs
index d8deea60725..59787c8036d 100644
--- a/src/libstd/treemap.rs
+++ b/src/libstd/treemap.rs
@@ -561,18 +561,18 @@ impl <K: Ord, V> TreeNode<K, V> {
 
 pure fn each<K: Ord, V>(node: &r/Option<~TreeNode<K, V>>,
                         f: fn(&(&r/K, &r/V)) -> bool) {
-    do node.map |x| {
+    do node.iter |x| {
         each(&x.left, f);
         if f(&(&x.key, &x.value)) { each(&x.right, f) }
-    };
+    }
 }
 
 pure fn each_reverse<K: Ord, V>(node: &r/Option<~TreeNode<K, V>>,
                                 f: fn(&(&r/K, &r/V)) -> bool) {
-    do node.map |x| {
+    do node.iter |x| {
         each_reverse(&x.right, f);
         if f(&(&x.key, &x.value)) { each_reverse(&x.left, f) }
-    };
+    }
 }
 
 // Remove left horizontal link by rotating right