Skip to content

Commit

Permalink
Derive Eq for std::cmp::Ordering, instead of using manual impl.
Browse files Browse the repository at this point in the history
This allows consts of type Ordering to be used in patterns, and (with feature(adt_const_params)) allows using Orderings as const generic parameters.
  • Loading branch information
zachs18 committed Mar 16, 2022
1 parent 461e807 commit ba611d5
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions library/core/src/cmp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ pub struct AssertParamIsEq<T: Eq + ?Sized> {
/// 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 {
Expand Down Expand Up @@ -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]
Expand Down

0 comments on commit ba611d5

Please sign in to comment.