Skip to content

Commit 5ec0a21

Browse files
committed
Introduce explanation about fields being used in ordering
1 parent 57fec79 commit 5ec0a21

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

library/core/src/cmp.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -707,7 +707,8 @@ impl<T: Clone> Clone for Reverse<T> {
707707
/// [lexicographic](https://en.wikipedia.org/wiki/Lexicographic_order) ordering
708708
/// based on the top-to-bottom declaration order of the struct's members.
709709
///
710-
/// When `derive`d on enums, variants are ordered by their discriminants.
710+
/// When `derive`d on enums, variants are ordered primarily by their discriminants.
711+
/// Secondarily, they are ordered by their fields.
711712
/// By default, the discriminant is smallest for variants at the top, and
712713
/// largest for variants at the bottom. Here's an example:
713714
///
@@ -960,7 +961,8 @@ pub macro Ord($item:item) {
960961
/// [lexicographic](https://en.wikipedia.org/wiki/Lexicographic_order) ordering
961962
/// based on the top-to-bottom declaration order of the struct's members.
962963
///
963-
/// When `derive`d on enums, variants are ordered by their discriminants.
964+
/// When `derive`d on enums, variants are primarily ordered by their discriminants.
965+
/// Secondarily, they are ordered by their fields.
964966
/// By default, the discriminant is smallest for variants at the top, and
965967
/// largest for variants at the bottom. Here's an example:
966968
///

0 commit comments

Comments
 (0)