Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-Authored-By: Jack Wrenn <johnswrenn@gmail.com>
  • Loading branch information
tspiteri and jswrenn committed Feb 29, 2020
1 parent 8a5fe0b commit cb66dd8
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/lib.rs
Expand Up @@ -2514,7 +2514,7 @@ pub trait Itertools : Iterator {
where Self: Sized, K: PartialOrd, F: FnMut(&Self::Item) -> K
{
use MinMaxResult::{NoElements, OneElement, MinMax};
match minmax::minmax_impl(self.enumerate(), |x| key(&x.1), |_, _, xk, yk| xk < yk) {
match self.enumerate().minmax_by_key(|e| key(&e.1)) {
NoElements => NoElements,
OneElement(x) => OneElement(x.0),
MinMax(x, y) => MinMax(x.0, y.0),
Expand Down Expand Up @@ -2557,11 +2557,7 @@ pub trait Itertools : Iterator {
where Self: Sized, F: FnMut(&Self::Item, &Self::Item) -> Ordering
{
use MinMaxResult::{NoElements, OneElement, MinMax};
match minmax::minmax_impl(
self.enumerate(),
|_| (),
|x, y, _, _| Ordering::Less == compare(&x.1, &y.1)
) {
match self.enumerate().minmax_by(|x, y| compare(&x.1, &y.1)) {
NoElements => NoElements,
OneElement(x) => OneElement(x.0),
MinMax(x, y) => MinMax(x.0, y.0),
Expand Down

0 comments on commit cb66dd8

Please sign in to comment.