Skip to content

Commit

Permalink
Introduce explanation about fields being used in ordering
Browse files Browse the repository at this point in the history
  • Loading branch information
The-Ludwig committed Dec 7, 2023
1 parent 57fec79 commit 5ec0a21
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions library/core/src/cmp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -707,7 +707,8 @@ impl<T: Clone> Clone for Reverse<T> {
/// [lexicographic](https://en.wikipedia.org/wiki/Lexicographic_order) ordering
/// based on the top-to-bottom declaration order of the struct's members.
///
/// When `derive`d on enums, variants are ordered by their discriminants.
/// When `derive`d on enums, variants are ordered primarily by their discriminants.
/// Secondarily, they are ordered by their fields.
/// By default, the discriminant is smallest for variants at the top, and
/// largest for variants at the bottom. Here's an example:
///
Expand Down Expand Up @@ -960,7 +961,8 @@ pub macro Ord($item:item) {
/// [lexicographic](https://en.wikipedia.org/wiki/Lexicographic_order) ordering
/// based on the top-to-bottom declaration order of the struct's members.
///
/// When `derive`d on enums, variants are ordered by their discriminants.
/// When `derive`d on enums, variants are primarily ordered by their discriminants.
/// Secondarily, they are ordered by their fields.
/// By default, the discriminant is smallest for variants at the top, and
/// largest for variants at the bottom. Here's an example:
///
Expand Down

0 comments on commit 5ec0a21

Please sign in to comment.