@@ -2514,7 +2514,7 @@ pub trait Itertools : Iterator {
2514
2514
where Self : Sized , K : PartialOrd , F : FnMut ( & Self :: Item ) -> K
2515
2515
{
2516
2516
use MinMaxResult :: { NoElements , OneElement , MinMax } ;
2517
- match minmax :: minmax_impl ( self . enumerate ( ) , |x | key ( & x . 1 ) , |_ , _ , xk , yk| xk < yk ) {
2517
+ match self . enumerate ( ) . minmax_by_key ( |e | key ( & e . 1 ) ) {
2518
2518
NoElements => NoElements ,
2519
2519
OneElement ( x) => OneElement ( x. 0 ) ,
2520
2520
MinMax ( x, y) => MinMax ( x. 0 , y. 0 ) ,
@@ -2557,11 +2557,7 @@ pub trait Itertools : Iterator {
2557
2557
where Self : Sized , F : FnMut ( & Self :: Item , & Self :: Item ) -> Ordering
2558
2558
{
2559
2559
use MinMaxResult :: { NoElements , OneElement , MinMax } ;
2560
- match minmax:: minmax_impl (
2561
- self . enumerate ( ) ,
2562
- |_| ( ) ,
2563
- |x, y, _, _| Ordering :: Less == compare ( & x. 1 , & y. 1 )
2564
- ) {
2560
+ match self . enumerate ( ) . minmax_by ( |x, y| compare ( & x. 1 , & y. 1 ) ) {
2565
2561
NoElements => NoElements ,
2566
2562
OneElement ( x) => OneElement ( x. 0 ) ,
2567
2563
MinMax ( x, y) => MinMax ( x. 0 , y. 0 ) ,
0 commit comments