diff options
Diffstat (limited to 'library/core/src/cmp.rs')
| -rw-r--r-- | library/core/src/cmp.rs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/library/core/src/cmp.rs b/library/core/src/cmp.rs index 20bb6768784..0facf37dfec 100644 --- a/library/core/src/cmp.rs +++ b/library/core/src/cmp.rs @@ -38,8 +38,10 @@ use self::Ordering::*; /// /// Implementations must ensure that `eq` and `ne` are consistent with each other: /// -/// - `a != b` if and only if `!(a == b)` -/// (ensured by the default implementation). +/// - `a != b` if and only if `!(a == b)`. +/// +/// The default implementation of `ne` provides this consistency and is almost +/// always sufficient. It should not be overridden without very good reason. /// /// If [`PartialOrd`] or [`Ord`] are also implemented for `Self` and `Rhs`, their methods must also /// be consistent with `PartialEq` (see the documentation of those traits for the exact @@ -225,7 +227,8 @@ pub trait PartialEq<Rhs: ?Sized = Self> { #[stable(feature = "rust1", since = "1.0.0")] fn eq(&self, other: &Rhs) -> bool; - /// This method tests for `!=`. + /// This method tests for `!=`. The default implementation is almost always + /// sufficient, and should not be overridden without very good reason. #[inline] #[must_use] #[stable(feature = "rust1", since = "1.0.0")] |
