Skip to content

Commit ba611d5

Browse files
committed
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.
1 parent 461e807 commit ba611d5

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

library/core/src/cmp.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ pub struct AssertParamIsEq<T: Eq + ?Sized> {
333333
/// let result = 2.cmp(&1);
334334
/// assert_eq!(Ordering::Greater, result);
335335
/// ```
336-
#[derive(Clone, Copy, PartialEq, Debug, Hash)]
336+
#[derive(Clone, Copy, PartialEq, Eq, Debug, Hash)]
337337
#[stable(feature = "rust1", since = "1.0.0")]
338338
#[repr(i8)]
339339
pub enum Ordering {
@@ -861,9 +861,6 @@ pub macro Ord($item:item) {
861861
/* compiler built-in */
862862
}
863863

864-
#[stable(feature = "rust1", since = "1.0.0")]
865-
impl Eq for Ordering {}
866-
867864
#[stable(feature = "rust1", since = "1.0.0")]
868865
impl Ord for Ordering {
869866
#[inline]

0 commit comments

Comments
 (0)