From ba611d55f39909f4c4da43fe96a275c4746c38d1 Mon Sep 17 00:00:00 2001 From: Zachary S Date: Wed, 16 Mar 2022 11:36:31 -0500 Subject: [PATCH] Derive Eq for std::cmp::Ordering, instead of using manual impl. This allows consts of type Ordering to be used in patterns, and (with feature(adt_const_params)) allows using Orderings as const generic parameters. --- library/core/src/cmp.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/library/core/src/cmp.rs b/library/core/src/cmp.rs index ddaeb9eca97..74328a3607d 100644 --- a/library/core/src/cmp.rs +++ b/library/core/src/cmp.rs @@ -333,7 +333,7 @@ pub struct AssertParamIsEq { /// let result = 2.cmp(&1); /// assert_eq!(Ordering::Greater, result); /// ``` -#[derive(Clone, Copy, PartialEq, Debug, Hash)] +#[derive(Clone, Copy, PartialEq, Eq, Debug, Hash)] #[stable(feature = "rust1", since = "1.0.0")] #[repr(i8)] pub enum Ordering { @@ -861,9 +861,6 @@ pub macro Ord($item:item) { /* compiler built-in */ } -#[stable(feature = "rust1", since = "1.0.0")] -impl Eq for Ordering {} - #[stable(feature = "rust1", since = "1.0.0")] impl Ord for Ordering { #[inline]