summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2023-03-31 13:51:17 +0000
committerOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2023-03-31 13:51:17 +0000
commitde08218f24998eb977170723dc0e334798494d85 (patch)
treec6eaa7a511cf897819b6816fabd761bfcbf0d0bf
parentd02cab1e18b870de3ba378579ec464d4a2381af3 (diff)
downloadrust-de08218f24998eb977170723dc0e334798494d85.tar.gz
Partially revert 5b08c9f39754039ef9c6cbde157ac9eb8c252a58
-rw-r--r--library/core/src/cmp.rs10
1 files changed, 8 insertions, 2 deletions
diff --git a/library/core/src/cmp.rs b/library/core/src/cmp.rs
index 85aa1de100a..068637d1a03 100644
--- a/library/core/src/cmp.rs
+++ b/library/core/src/cmp.rs
@@ -800,7 +800,10 @@ pub trait Ord: Eq + PartialOrd<Self> {
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> {
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.