Remove duplicate section · qinheping/verify-rust-std@08ac3a0 (original) (raw)
`@@ -775,19 +775,7 @@ impl<T: Clone> Clone for Reverse {
`
775
775
`///
`
776
776
`` /// ## How can I implement Ord
?
``
777
777
`///
`
778
``
`` -
/// Ord
requires that the type also be [PartialOrd
], [PartialEq
] and [Eq
].
``
779
``
`-
///
`
780
``
`` -
/// If you manually implement Ord
, you should also implement [PartialOrd
]. It is a logic error
``
781
``
`` -
/// to have [PartialOrd
] and Ord
disagree, so it is best to have the logic in Ord
and
``
782
``
`` -
/// implement [PartialOrd
] as Some(self.cmp(other))
.
``
783
``
`-
///
`
784
``
`` -
/// Conceptually [PartialOrd
] and Ord
form a similar relationship to [PartialEq
] and [Eq
].
``
785
``
`` -
/// [PartialEq
] defines an equality relationship between types, and [Eq
] defines an additional
``
786
``
`` -
/// property on top of the properties implied by [PartialEq
], namely reflexivity. In a similar
``
787
``
`` -
/// fashion Ord
builds on top of [PartialOrd
] and adds further properties, such as totality,
``
788
``
`-
/// which means all values must be comparable.
`
789
``
`-
///
`
790
``
`` -
/// Ord
requires that the type also be PartialOrd, PartialEq, and Eq.
``
``
778
`` +
/// Ord
requires that the type also be [PartialOrd
], [PartialEq
], and [Eq
].
``
791
779
`///
`
792
780
`` /// Because Ord
implies a stronger ordering relationship than [PartialOrd
], and both Ord
and
``
793
781
`` /// [PartialOrd
] must agree, you must choose how to implement Ord
first. You can choose to
``