@@ -310,10 +310,10 @@ pub trait IteratorUtil<A> {
310
310
fn any_ ( & mut self , f : & fn ( A ) -> bool ) -> bool ;
311
311
312
312
/// 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 > ;
314
314
315
315
/// 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 > ;
317
317
}
318
318
319
319
/// 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 {
448
448
449
449
/// Return the first element satisfying the specified predicate
450
450
#[ inline( always) ]
451
- fn find ( & mut self , predicate : & fn ( & A ) -> bool ) -> Option < A > {
451
+ fn find_ ( & mut self , predicate : & fn ( & A ) -> bool ) -> Option < A > {
452
452
for self . advance |x| {
453
453
if predicate ( & x) { return Some ( x) }
454
454
}
@@ -457,7 +457,7 @@ impl<A, T: Iterator<A>> IteratorUtil<A> for T {
457
457
458
458
/// Return the index of the first element satisfying the specified predicate
459
459
#[ inline]
460
- fn position ( & mut self , predicate : & fn ( A ) -> bool ) -> Option < uint > {
460
+ fn position_ ( & mut self , predicate : & fn ( A ) -> bool ) -> Option < uint > {
461
461
let mut i = 0 ;
462
462
for self . advance |x| {
463
463
if predicate ( x) {
@@ -1087,16 +1087,16 @@ mod tests {
1087
1087
#[ test]
1088
1088
fn test_find( ) {
1089
1089
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( ) ) ;
1093
1093
}
1094
1094
1095
1095
#[ test]
1096
1096
fn test_position( ) {
1097
1097
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( ) ) ;
1101
1101
}
1102
1102
}
0 commit comments