Skip to content

Commit de08218

Browse files
committed
Partially revert 5b08c9f
1 parent d02cab1 commit de08218

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

library/core/src/cmp.rs

+8-2
Original file line numberDiff line numberDiff line change
@@ -800,7 +800,10 @@ pub trait Ord: Eq + PartialOrd<Self> {
800800
Self: Sized,
801801
Self: ~const Destruct,
802802
{
803-
max_by(self, other, Ord::cmp)
803+
match self.cmp(&other) {
804+
Ordering::Less | Ordering::Equal => other,
805+
Ordering::Greater => self,
806+
}
804807
}
805808

806809
/// Compares and returns the minimum of two values.
@@ -821,7 +824,10 @@ pub trait Ord: Eq + PartialOrd<Self> {
821824
Self: Sized,
822825
Self: ~const Destruct,
823826
{
824-
min_by(self, other, Ord::cmp)
827+
match self.cmp(&other) {
828+
Ordering::Less | Ordering::Equal => self,
829+
Ordering::Greater => other,
830+
}
825831
}
826832

827833
/// Restrict a value to a certain interval.

0 commit comments

Comments
 (0)