Merge pull request #451 from ChrisJefferson/master

Use expect in Chapter 3, as in Chapter 2
This commit is contained in:
Carol (Nichols || Goulding)
2017-02-19 10:07:39 -05:00
committed by GitHub
+2 -2
View File
@@ -13,7 +13,7 @@ converted a `String` to a numeric type using `parse` in Chapter 2, we must add
a type annotation, like this: a type annotation, like this:
```rust ```rust
let guess: u32 = "42".parse().unwrap(); let guess: u32 = "42".parse().expect("Not a number!");
``` ```
If we don’t add the type annotation here, Rust will display the following If we don’t add the type annotation here, Rust will display the following
@@ -24,7 +24,7 @@ possible type we want to use:
error[E0282]: unable to infer enough type information about `_` error[E0282]: unable to infer enough type information about `_`
--> src/main.rs:2:5 --> src/main.rs:2:5
| |
2 | let guess = "42".parse().unwrap(); 2 | let guess = "42".parse().expect("Not a number!");
| ^^^^^ cannot infer type for `_` | ^^^^^ cannot infer type for `_`
| |
= note: type annotations or generic parameter binding required = note: type annotations or generic parameter binding required