mirror of
https://github.com/rust-lang/book.git
synced 2026-11-30 21:41:18 -06:00
Merge pull request #435 from s3rvac/chapter09-fix-grammar-and-formatting
Fix grammar and formatting in Chapter 09
This commit is contained in:
@@ -240,11 +240,11 @@ otherwise, the pattern matching will move on to consider the next arm in the
|
|||||||
into the guard condition but is merely referenced by it. The reason `ref` is
|
into the guard condition but is merely referenced by it. The reason `ref` is
|
||||||
used to take a reference in a pattern instead of `&` will be covered in detail
|
used to take a reference in a pattern instead of `&` will be covered in detail
|
||||||
in Chapter XX. In short, in the context of a pattern, `&` matches a reference
|
in Chapter XX. In short, in the context of a pattern, `&` matches a reference
|
||||||
and give us its value, but `ref` matches a value and gives us a reference to it.
|
and gives us its value, but `ref` matches a value and gives us a reference to it.
|
||||||
|
|
||||||
The condition we want to check in the match guard is whether the value returned
|
The condition we want to check in the match guard is whether the value returned
|
||||||
by `error.kind()` is the `NotFound` variant of the `ErrorKind` enum. If it is,
|
by `error.kind()` is the `NotFound` variant of the `ErrorKind` enum. If it is,
|
||||||
we try to create the file with 'File::create'. However, since `File::create`
|
we try to create the file with `File::create`. However, since `File::create`
|
||||||
could also fail, we need to add an inner `match` statement as well! When the
|
could also fail, we need to add an inner `match` statement as well! When the
|
||||||
file can't be opened, a different error message will be printed. The last arm
|
file can't be opened, a different error message will be printed. The last arm
|
||||||
of the outer `match` stays the same so that the program panics on any error
|
of the outer `match` stays the same so that the program panics on any error
|
||||||
|
|||||||
Reference in New Issue
Block a user