From de08218f24998eb977170723dc0e334798494d85 Mon Sep 17 00:00:00 2001 From: Oli Scherer Date: Fri, 31 Mar 2023 13:51:17 +0000 Subject: [PATCH] Partially revert 5b08c9f39754039ef9c6cbde157ac9eb8c252a58 --- library/core/src/cmp.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/library/core/src/cmp.rs b/library/core/src/cmp.rs index 85aa1de100ae..068637d1a035 100644 --- a/library/core/src/cmp.rs +++ b/library/core/src/cmp.rs @@ -800,7 +800,10 @@ pub trait Ord: Eq + PartialOrd { Self: Sized, Self: ~const Destruct, { - max_by(self, other, Ord::cmp) + match self.cmp(&other) { + Ordering::Less | Ordering::Equal => other, + Ordering::Greater => self, + } } /// Compares and returns the minimum of two values. @@ -821,7 +824,10 @@ pub trait Ord: Eq + PartialOrd { Self: Sized, Self: ~const Destruct, { - min_by(self, other, Ord::cmp) + match self.cmp(&other) { + Ordering::Less | Ordering::Equal => self, + Ordering::Greater => other, + } } /// Restrict a value to a certain interval.