File tree Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -668,7 +668,7 @@ impl<T: Clone> Clone for Reverse<T> {
668
668
/// Here's an example:
669
669
///
670
670
/// ```
671
- /// #[derive(PartialEq, PartialOrd)]
671
+ /// #[derive(PartialEq, Eq, PartialOrd, Ord )]
672
672
/// enum Size {
673
673
/// Small,
674
674
/// Large,
@@ -898,6 +898,18 @@ impl PartialOrd for Ordering {
898
898
/// This trait can be used with `#[derive]`. When `derive`d on structs, it will produce a
899
899
/// lexicographic ordering based on the top-to-bottom declaration order of the struct's members.
900
900
/// When `derive`d on enums, variants are ordered by their top-to-bottom discriminant order.
901
+ /// This means variants at the top are less than variants at the bottom.
902
+ /// Here's an example:
903
+ ///
904
+ /// ```
905
+ /// #[derive(PartialEq, PartialOrd)]
906
+ /// enum Size {
907
+ /// Small,
908
+ /// Large,
909
+ /// }
910
+ ///
911
+ /// assert!(Size::Small < Size::Large);
912
+ /// ```
901
913
///
902
914
/// ## How can I implement `PartialOrd`?
903
915
///
@@ -970,8 +982,8 @@ impl PartialOrd for Ordering {
970
982
/// # Examples
971
983
///
972
984
/// ```
973
- /// let x : u32 = 0;
974
- /// let y : u32 = 1;
985
+ /// let x: u32 = 0;
986
+ /// let y: u32 = 1;
975
987
///
976
988
/// assert_eq!(x < y, true);
977
989
/// assert_eq!(x.lt(&y), true);
You can’t perform that action at this time.
0 commit comments