Merge pull request #1108 from bmusin/patch-4

refine wording
This commit is contained in:
Carol (Nichols || Goulding) 2018-01-12 16:04:37 -05:00 committed by GitHub
commit af9784ade1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -554,7 +554,7 @@ fn main() {
}
```
This is a little better, but now we've written a lot more code! The case
This is a little better, but now we've written much more code! The case
analysis has once again bitten us.
Combinators to the rescue! Just like `Option`, `Result` has lots of combinators
@ -815,7 +815,7 @@ type from `i32` to something else.
The first thing we need to decide: should we use `Option` or `Result`? We
certainly could use `Option` very easily. If any of the three errors occur, we
could simply return `None`. This will work *and it is better than panicking*,
but we can do a lot better. Instead, we should pass some detail about the error
but we can do much better. Instead, we should pass some detail about the error
that occurred. Since we want to express the *possibility of error*, we should
use `Result<i32, E>`. But what should `E` be? Since two *different* types of
errors can occur, we need to convert them to a common type. One such type is
@ -1285,7 +1285,7 @@ macro_rules! try {
```
There's one tiny but powerful change: the error value is passed through
`From::from`. This makes the `try!` macro a lot more powerful because it gives
`From::from`. This makes the `try!` macro much more powerful because it gives
you automatic type conversion for free.
Armed with our more powerful `try!` macro, let's take a look at code we wrote