diff --git a/src/libcore/option.rs b/src/libcore/option.rs index cfc2cba922602..c2af5f8b73b1c 100644 --- a/src/libcore/option.rs +++ b/src/libcore/option.rs @@ -201,7 +201,7 @@ pub pure fn map_default(opt: &r/Option, def: U, } #[inline(always)] -pub pure fn iter(opt: &Option, f: fn(x: &T)) { +pub pure fn iter(opt: &r/Option, 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 Option { /// 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 d8deea60725a0..59787c8036ddb 100644 --- a/src/libstd/treemap.rs +++ b/src/libstd/treemap.rs @@ -561,18 +561,18 @@ impl TreeNode { pure fn each(node: &r/Option<~TreeNode>, 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(node: &r/Option<~TreeNode>, 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