summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/src/docs/derive_ord_xor_partial_ord.txt
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/clippy/src/docs/derive_ord_xor_partial_ord.txt')
-rw-r--r--src/tools/clippy/src/docs/derive_ord_xor_partial_ord.txt44
1 files changed, 0 insertions, 44 deletions
diff --git a/src/tools/clippy/src/docs/derive_ord_xor_partial_ord.txt b/src/tools/clippy/src/docs/derive_ord_xor_partial_ord.txt
deleted file mode 100644
index f2107a5f6..000000000
--- a/src/tools/clippy/src/docs/derive_ord_xor_partial_ord.txt
+++ /dev/null
@@ -1,44 +0,0 @@
-### What it does
-Checks for deriving `Ord` but implementing `PartialOrd`
-explicitly or vice versa.
-
-### Why is this bad?
-The implementation of these traits must agree (for
-example for use with `sort`) so it’s probably a bad idea to use a
-default-generated `Ord` implementation with an explicitly defined
-`PartialOrd`. In particular, the following must hold for any type
-implementing `Ord`:
-
-```
-k1.cmp(&k2) == k1.partial_cmp(&k2).unwrap()
-```
-
-### Example
-```
-#[derive(Ord, PartialEq, Eq)]
-struct Foo;
-
-impl PartialOrd for Foo {
- ...
-}
-```
-Use instead:
-```
-#[derive(PartialEq, Eq)]
-struct Foo;
-
-impl PartialOrd for Foo {
- fn partial_cmp(&self, other: &Foo) -> Option<Ordering> {
- Some(self.cmp(other))
- }
-}
-
-impl Ord for Foo {
- ...
-}
-```
-or, if you don't need a custom ordering:
-```
-#[derive(Ord, PartialOrd, PartialEq, Eq)]
-struct Foo;
-``` \ No newline at end of file