@@ -607,15 +607,15 @@ fn test_count() {
607607}
608608
609609#[ test]
610- fn test_max_by ( ) {
610+ fn test_max_by_key ( ) {
611611 let xs: & [ isize ] = & [ -3 , 0 , 1 , 5 , -10 ] ;
612- assert_eq ! ( * xs. iter( ) . max_by ( |x| x. abs( ) ) . unwrap( ) , -10 ) ;
612+ assert_eq ! ( * xs. iter( ) . max_by_key ( |x| x. abs( ) ) . unwrap( ) , -10 ) ;
613613}
614614
615615#[ test]
616- fn test_min_by ( ) {
616+ fn test_min_by_key ( ) {
617617 let xs: & [ isize ] = & [ -3 , 0 , 1 , 5 , -10 ] ;
618- assert_eq ! ( * xs. iter( ) . min_by ( |x| x. abs( ) ) . unwrap( ) , 0 ) ;
618+ assert_eq ! ( * xs. iter( ) . min_by_key ( |x| x. abs( ) ) . unwrap( ) , 0 ) ;
619619}
620620
621621#[ test]
@@ -961,18 +961,18 @@ fn bench_multiple_take(b: &mut Bencher) {
961961fn scatter ( x : i32 ) -> i32 { ( x * 31 ) % 127 }
962962
963963#[ bench]
964- fn bench_max_by ( b : & mut Bencher ) {
964+ fn bench_max_by_key ( b : & mut Bencher ) {
965965 b. iter ( || {
966966 let it = 0 ..100 ;
967- it. max_by ( |& x| scatter ( x) )
967+ it. max_by_key ( |& x| scatter ( x) )
968968 } )
969969}
970970
971971// http://www.reddit.com/r/rust/comments/31syce/using_iterators_to_find_the_index_of_the_min_or/
972972#[ bench]
973- fn bench_max_by2 ( b : & mut Bencher ) {
973+ fn bench_max_by_key2 ( b : & mut Bencher ) {
974974 fn max_index_iter ( array : & [ i32 ] ) -> usize {
975- array. iter ( ) . enumerate ( ) . max_by ( |& ( _, item) | item) . unwrap ( ) . 0
975+ array. iter ( ) . enumerate ( ) . max_by_key ( |& ( _, item) | item) . unwrap ( ) . 0
976976 }
977977
978978 let mut data = vec ! [ 0i32 ; 1638 ] ;
0 commit comments