Skip to content

Commit 491b34a

Browse files
committed
Add {min,max}_set(_by{_key)?)? functions (3) use Ord instead of PartialOrd
We may relax this bound at some point, but I'd go with this until we have evidence that it bothers users, as there have been cases where I actually was happy to be informed about Ord vs PartialOrd.
1 parent bb8b41a commit 491b34a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2928,7 +2928,7 @@ pub trait Itertools : Iterator {
29282928
/// if an element is NaN.
29292929
#[cfg(feature = "use_std")]
29302930
fn min_set(self) -> Vec<Self::Item>
2931-
where Self: Sized, Self::Item: PartialOrd
2931+
where Self: Sized, Self::Item: Ord
29322932
{
29332933
extrema_set::min_set_impl(self, |_| (), |x, y, _, _| x < y)
29342934
}
@@ -2993,7 +2993,7 @@ pub trait Itertools : Iterator {
29932993
/// if an element is NaN.
29942994
#[cfg(feature = "use_std")]
29952995
fn min_set_by_key<K, F>(self, key: F) -> Vec<Self::Item>
2996-
where Self: Sized, K: PartialOrd, F: FnMut(&Self::Item) -> K
2996+
where Self: Sized, K: Ord, F: FnMut(&Self::Item) -> K
29972997
{
29982998
extrema_set::min_set_impl(self, key, |_, _, kx, ky| kx < ky)
29992999
}
@@ -3022,7 +3022,7 @@ pub trait Itertools : Iterator {
30223022
/// if an element is NaN.
30233023
#[cfg(feature = "use_std")]
30243024
fn max_set(self) -> Vec<Self::Item>
3025-
where Self: Sized, Self::Item: PartialOrd
3025+
where Self: Sized, Self::Item: Ord
30263026
{
30273027
extrema_set::max_set_impl(self, |_| (), |x, y, _, _| x < y)
30283028
}
@@ -3087,7 +3087,7 @@ pub trait Itertools : Iterator {
30873087
/// if an element is NaN.
30883088
#[cfg(feature = "use_std")]
30893089
fn max_set_by_key<K, F>(self, key: F) -> Vec<Self::Item>
3090-
where Self: Sized, K: PartialOrd, F: FnMut(&Self::Item) -> K
3090+
where Self: Sized, K: Ord, F: FnMut(&Self::Item) -> K
30913091
{
30923092
extrema_set::max_set_impl(self, key, |_, _, kx, ky| kx < ky)
30933093
}

0 commit comments

Comments
 (0)