]> git.lizzy.rs Git - rust.git/commitdiff
Make std::cmp::Ord documentation specify what it means to agree with PartialEq
authorCzipperz <czipperz@gmail.com>
Sat, 29 Dec 2018 22:48:43 +0000 (17:48 -0500)
committerCzipperz <czipperz@gmail.com>
Sat, 29 Dec 2018 22:48:43 +0000 (17:48 -0500)
src/libcore/cmp.rs

index 9336b130d1bb2e0f56f75670b67b90c8c99ed8bb..8eff9a8c8a26a0668d5d1d06bc4ac73d804a98ce 100644 (file)
@@ -472,9 +472,10 @@ fn cmp(&self, other: &Reverse<T>) -> Ordering {
 /// Then you must define an implementation for `cmp()`. You may find it useful to use
 /// `cmp()` on your type's fields.
 ///
-/// Implementations of `PartialEq`, `PartialOrd`, and `Ord` *must* agree with each other. It's
-/// easy to accidentally make them disagree by deriving some of the traits and manually
-/// implementing others.
+/// Implementations of `PartialEq`, `PartialOrd`, and `Ord` *must*
+/// agree with each other. That is, `a.cmp(b) == Ordering::Equal` if
+/// and only if `a == b`. It's easy to accidentally make them disagree
+/// by deriving some of the traits and manually implementing others.
 ///
 /// Here's an example where you want to sort people by height only, disregarding `id`
 /// and `name`: