File tree 1 file changed +5
-3
lines changed
1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -472,9 +472,11 @@ impl<T: Ord> Ord for Reverse<T> {
472
472
/// Then you must define an implementation for `cmp()`. You may find it useful to use
473
473
/// `cmp()` on your type's fields.
474
474
///
475
- /// Implementations of `PartialEq`, `PartialOrd`, and `Ord` *must* agree with each other. It's
476
- /// easy to accidentally make them disagree by deriving some of the traits and manually
477
- /// implementing others.
475
+ /// Implementations of `PartialEq`, `PartialOrd`, and `Ord` *must*
476
+ /// agree with each other. That is, `a.cmp(b) == Ordering::Equal` if
477
+ /// and only if `a == b` and `Some(a.cmp(b)) == a.partial_cmp(b)` for
478
+ /// all `a` and `b`. It's easy to accidentally make them disagree by
479
+ /// deriving some of the traits and manually implementing others.
478
480
///
479
481
/// Here's an example where you want to sort people by height only, disregarding `id`
480
482
/// and `name`:
You can’t perform that action at this time.
0 commit comments