diff --git a/library/core/src/cmp.rs b/library/core/src/cmp.rs index a3e77479911..ddaeb9eca97 100644 --- a/library/core/src/cmp.rs +++ b/library/core/src/cmp.rs @@ -885,19 +885,18 @@ fn partial_cmp(&self, other: &Ordering) -> Option { /// The `lt`, `le`, `gt`, and `ge` methods of this trait can be called using /// the `<`, `<=`, `>`, and `>=` operators, respectively. /// -/// The methods of this trait must be consistent with each other and with those of `PartialEq` in -/// the following sense: +/// The methods of this trait must be consistent with each other and with those of [`PartialEq`]. +/// The following conditions must hold: /// -/// - `a == b` if and only if `partial_cmp(a, b) == Some(Equal)`. -/// - `a < b` if and only if `partial_cmp(a, b) == Some(Less)` -/// (ensured by the default implementation). -/// - `a > b` if and only if `partial_cmp(a, b) == Some(Greater)` -/// (ensured by the default implementation). -/// - `a <= b` if and only if `a < b || a == b` -/// (ensured by the default implementation). -/// - `a >= b` if and only if `a > b || a == b` -/// (ensured by the default implementation). -/// - `a != b` if and only if `!(a == b)` (already part of `PartialEq`). +/// 1. `a == b` if and only if `partial_cmp(a, b) == Some(Equal)`. +/// 2. `a < b` if and only if `partial_cmp(a, b) == Some(Less)` +/// 3. `a > b` if and only if `partial_cmp(a, b) == Some(Greater)` +/// 4. `a <= b` if and only if `a < b || a == b` +/// 5. `a >= b` if and only if `a > b || a == b` +/// 6. `a != b` if and only if `!(a == b)`. +/// +/// Conditions 2–5 above are ensured by the default implementation. +/// Condition 6 is already ensured by [`PartialEq`]. /// /// If [`Ord`] is also implemented for `Self` and `Rhs`, it must also be consistent with /// `partial_cmp` (see the documentation of that trait for the exact requirements). It's