Skip to content

Commit 79cd2db

Browse files
committed
iterator: work around method resolve bug
1 parent 2df66a8 commit 79cd2db

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/libstd/iterator.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -310,10 +310,10 @@ pub trait IteratorUtil<A> {
310310
fn any_(&mut self, f: &fn(A) -> bool) -> bool;
311311

312312
/// Return the first element satisfying the specified predicate
313-
fn find(&mut self, predicate: &fn(&A) -> bool) -> Option<A>;
313+
fn find_(&mut self, predicate: &fn(&A) -> bool) -> Option<A>;
314314

315315
/// Return the index of the first element satisfying the specified predicate
316-
fn position(&mut self, predicate: &fn(A) -> bool) -> Option<uint>;
316+
fn position_(&mut self, predicate: &fn(A) -> bool) -> Option<uint>;
317317
}
318318

319319
/// Iterator adaptors provided for every `Iterator` implementation. The adaptor objects are also
@@ -448,7 +448,7 @@ impl<A, T: Iterator<A>> IteratorUtil<A> for T {
448448

449449
/// Return the first element satisfying the specified predicate
450450
#[inline(always)]
451-
fn find(&mut self, predicate: &fn(&A) -> bool) -> Option<A> {
451+
fn find_(&mut self, predicate: &fn(&A) -> bool) -> Option<A> {
452452
for self.advance |x| {
453453
if predicate(&x) { return Some(x) }
454454
}
@@ -457,7 +457,7 @@ impl<A, T: Iterator<A>> IteratorUtil<A> for T {
457457

458458
/// Return the index of the first element satisfying the specified predicate
459459
#[inline]
460-
fn position(&mut self, predicate: &fn(A) -> bool) -> Option<uint> {
460+
fn position_(&mut self, predicate: &fn(A) -> bool) -> Option<uint> {
461461
let mut i = 0;
462462
for self.advance |x| {
463463
if predicate(x) {
@@ -1087,16 +1087,16 @@ mod tests {
10871087
#[test]
10881088
fn test_find() {
10891089
let v = &[1, 3, 9, 27, 103, 14, 11];
1090-
assert_eq!(*v.iter().find(|x| *x & 1 == 0).unwrap(), 14);
1091-
assert_eq!(*v.iter().find(|x| *x % 3 == 0).unwrap(), 3);
1092-
assert!(v.iter().find(|x| *x % 12 == 0).is_none());
1090+
assert_eq!(*v.iter().find_(|x| *x & 1 == 0).unwrap(), 14);
1091+
assert_eq!(*v.iter().find_(|x| *x % 3 == 0).unwrap(), 3);
1092+
assert!(v.iter().find_(|x| *x % 12 == 0).is_none());
10931093
}
10941094

10951095
#[test]
10961096
fn test_position() {
10971097
let v = &[1, 3, 9, 27, 103, 14, 11];
1098-
assert_eq!(v.iter().position(|x| *x & 1 == 0).unwrap(), 5);
1099-
assert_eq!(v.iter().position(|x| *x % 3 == 0).unwrap(), 1);
1100-
assert!(v.iter().position(|x| *x % 12 == 0).is_none());
1098+
assert_eq!(v.iter().position_(|x| *x & 1 == 0).unwrap(), 5);
1099+
assert_eq!(v.iter().position_(|x| *x % 3 == 0).unwrap(), 1);
1100+
assert!(v.iter().position_(|x| *x % 12 == 0).is_none());
11011101
}
11021102
}

0 commit comments

Comments
 (0)