From 58a7d586869b3d822037d339b26c03fd53ea08c8 Mon Sep 17 00:00:00 2001 From: Steve Klabnik Date: Fri, 13 Feb 2015 09:37:05 -0500 Subject: [PATCH] Re-word paragraph about enums and equality Fixes #22035. --- src/doc/trpl/compound-data-types.md | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/doc/trpl/compound-data-types.md b/src/doc/trpl/compound-data-types.md index 51a4edbdac8..dea19fa73fb 100644 --- a/src/doc/trpl/compound-data-types.md +++ b/src/doc/trpl/compound-data-types.md @@ -263,15 +263,12 @@ let four_is_smaller = four <= ten; let four_equals_ten = four == ten; ``` -This may seem rather limiting, particularly equality being invalid; in -many cases however, it's unnecessary. Rust provides the [`match`][match] -keyword, which will be examined in more detail in the next section, which -often allows better and easier branch control than a series of `if`/`else` -statements would. However, for our [game][game] we need the comparisons -to work so we will utilize the `Ordering` `enum` provided by the standard -library which supports such comparisons. It has this form: +This may seem rather limiting, but it's a limitation which we can overcome. +There are two ways: by implementing equality ourselves, or by using the +[`match`][match] keyword. We don't know enough about Rust to implement equality +yet, but we can use the `Ordering` enum from the standard library, which does: -```{rust} +``` enum Ordering { Less, Equal,