@@ -1056,17 +1056,6 @@ pub fn contains<T:Eq>(v: &[T], x: &T) -> bool {
10561056 false
10571057}
10581058
1059- /**
1060- * Search for the first element that matches a given predicate
1061- *
1062- * Apply function `f` to each element of `v`, starting from the first.
1063- * When function `f` returns true then an option containing the element
1064- * is returned. If `f` matches no elements then none is returned.
1065- */
1066- pub fn find < T : Copy > ( v : & [ T ] , f : & fn ( t : & T ) -> bool ) -> Option < T > {
1067- find_between ( v, 0 u, v. len ( ) , f)
1068- }
1069-
10701059/**
10711060 * Search for the first element that matches a given predicate within a range
10721061 *
@@ -3163,18 +3152,6 @@ mod tests {
31633152 assert ! ( position_between( v, 4 u, 4 u, f) . is_none( ) ) ;
31643153 }
31653154
3166- #[ test]
3167- fn test_find ( ) {
3168- assert ! ( find( [ ] , f) . is_none( ) ) ;
3169-
3170- fn f ( xy : & ( int , char ) ) -> bool { let ( _x, y) = * xy; y == 'b' }
3171- fn g ( xy : & ( int , char ) ) -> bool { let ( _x, y) = * xy; y == 'd' }
3172- let v = ~[ ( 0 , 'a' ) , ( 1 , 'b' ) , ( 2 , 'c' ) , ( 3 , 'b' ) ] ;
3173-
3174- assert_eq ! ( find( v, f) , Some ( ( 1 , 'b' ) ) ) ;
3175- assert ! ( find( v, g) . is_none( ) ) ;
3176- }
3177-
31783155 #[ test]
31793156 fn test_find_between ( ) {
31803157 assert ! ( find_between( [ ] , 0 u, 0 u, f) . is_none( ) ) ;
@@ -3205,8 +3182,6 @@ mod tests {
32053182
32063183 #[ test]
32073184 fn test_rposition ( ) {
3208- assert ! ( find( [ ] , f) . is_none( ) ) ;
3209-
32103185 fn f ( xy : & ( int , char ) ) -> bool { let ( _x, y) = * xy; y == 'b' }
32113186 fn g ( xy : & ( int , char ) ) -> bool { let ( _x, y) = * xy; y == 'd' }
32123187 let v = ~[ ( 0 , 'a' ) , ( 1 , 'b' ) , ( 2 , 'c' ) , ( 3 , 'b' ) ] ;
@@ -3838,22 +3813,6 @@ mod tests {
38383813 } ;
38393814 }
38403815
3841- #[ test]
3842- #[ ignore( windows) ]
3843- #[ should_fail]
3844- #[ allow( non_implicitly_copyable_typarams) ]
3845- fn test_find_fail ( ) {
3846- let v = [ ( ~0 , @0 ) , ( ~0 , @0 ) , ( ~0 , @0 ) , ( ~0 , @0 ) ] ;
3847- let mut i = 0 ;
3848- do find( v) |_elt| {
3849- if i == 2 {
3850- fail ! ( )
3851- }
3852- i += 0 ;
3853- false
3854- } ;
3855- }
3856-
38573816 #[ test]
38583817 #[ ignore( windows) ]
38593818 #[ should_fail]
0 commit comments