diff --git a/src/ch06-00-enums.md b/src/ch06-00-enums.md index 19d9cb9a9..4c619b09c 100644 --- a/src/ch06-00-enums.md +++ b/src/ch06-00-enums.md @@ -93,7 +93,7 @@ both values `IpAddrKind::V4` and `IpAddrKind::V6` are of the same type: fn route(ip_type: IpAddrKind) { } ``` -And we can call this function with either value that we have: +And we can call this function with either variant: ```rust # enum IpAddrKind { @@ -172,7 +172,7 @@ There's another advantage to using an enum over a struct: each variant can store *different kinds* of data. Version four type IP addresses will always have four numeric components that will have values between 0 and 255. If we wanted to store `V4` addresses as four `u8`s but still express `V6` addresses -as `String`s, we wouldn't be able to with a `struct`. Enums deal with this case +as `String`s, we wouldn't be able to with a `struct`. Enums handle this case with ease: ```rust diff --git a/src/ch06-01-option.md b/src/ch06-01-option.md index 4a7d19901..a8981567b 100644 --- a/src/ch06-01-option.md +++ b/src/ch06-01-option.md @@ -15,7 +15,7 @@ the *null* feature that many other languages have. Null is a value that means there is no value there. In languages with null, variables can always be in one of two states: null or not-null. -The inventor of the null concept has this to say: +The inventor of null has this to say: > I call it my billion-dollar mistake. At that time, I was designing the first > comprehensive type system for references in an object-oriented language. My @@ -64,11 +64,11 @@ before mentioning it so they know what significance it has here --> -The `` is a feature of Rust we haven't talked about yet. It's a generic type -parameter, and we'll cover generics in more detail in Chapter 10. For now, all -you need to know is that this means the `Some` variant of the `Option` enum can -hold one piece of data of any type. Here are some examples of using `Option` -values to hold number types and string types: +The `` syntax is a feature of Rust we haven't talked about yet. It's a +generic type parameter, and we'll cover generics in more detail in Chapter 10. +For now, all you need to know is that this means the `Some` variant of the +`Option` enum can hold one piece of data of any type. Here are some examples of +using `Option` values to hold number types and string types: ```rust let some_number = Some(5); diff --git a/src/ch06-02-match.md b/src/ch06-02-match.md index e6c4a2a56..1057ae984 100644 --- a/src/ch06-02-match.md +++ b/src/ch06-02-match.md @@ -294,7 +294,7 @@ match some_u8_value { 3 => println!("three"), 5 => println!("five"), 7 => println!("seven"), - _ => {}, + _ => (), } ``` diff --git a/src/ch06-03-if-let.md b/src/ch06-03-if-let.md index cd7b3b3f5..68cadb722 100644 --- a/src/ch06-03-if-let.md +++ b/src/ch06-03-if-let.md @@ -10,13 +10,13 @@ match some_option { Some(x) => { // do something with x }, - None => {}, + None => (), } ``` We want to do something with the `Some` match, but do nothing with the `None` case. We can do this with an `Option`, but with a more complex enum, -adding `_ => {}` after processing just one variant is a lot of boilerplate code +adding `_ => ()` after processing just one variant is a lot of boilerplate code that we have to add to satisfy the `match` expression. Instead, we could write this in a shorter way with `if let`. This code behaves