Skip to content

Commit 210fa2d

Browse files
committedFeb 12, 2013
auto merge of #4874 : thestinger/rust/option, r=catamorphism
2 parents 1c487b1 + 99ff74c commit 210fa2d

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed
 

‎src/libcore/option.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ pub pure fn map_default<T, U>(opt: &r/Option<T>, def: U,
201201
}
202202
203203
#[inline(always)]
204-
pub pure fn iter<T>(opt: &Option<T>, f: fn(x: &T)) {
204+
pub pure fn iter<T>(opt: &r/Option<T>, f: fn(x: &r/T)) {
205205
//! Performs an operation on the contained value by reference
206206
match *opt { None => (), Some(ref t) => f(t) }
207207
}
@@ -313,7 +313,7 @@ impl<T> Option<T> {
313313
314314
/// Performs an operation on the contained value by reference
315315
#[inline(always)]
316-
pure fn iter(&self, f: fn(x: &T)) { iter(self, f) }
316+
pure fn iter(&self, f: fn(x: &self/T)) { iter(self, f) }
317317
318318
/**
319319
Gets an immutable reference to the value inside an option.

‎src/libstd/treemap.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -561,18 +561,18 @@ impl <K: Ord, V> TreeNode<K, V> {
561561

562562
pure fn each<K: Ord, V>(node: &r/Option<~TreeNode<K, V>>,
563563
f: fn(&(&r/K, &r/V)) -> bool) {
564-
do node.map |x| {
564+
do node.iter |x| {
565565
each(&x.left, f);
566566
if f(&(&x.key, &x.value)) { each(&x.right, f) }
567-
};
567+
}
568568
}
569569

570570
pure fn each_reverse<K: Ord, V>(node: &r/Option<~TreeNode<K, V>>,
571571
f: fn(&(&r/K, &r/V)) -> bool) {
572-
do node.map |x| {
572+
do node.iter |x| {
573573
each_reverse(&x.right, f);
574574
if f(&(&x.key, &x.value)) { each_reverse(&x.left, f) }
575-
};
575+
}
576576
}
577577

578578
// Remove left horizontal link by rotating right

0 commit comments

Comments
 (0)
Please sign in to comment.