From afe9888ebfa7bcfaecfc044c62d171b48801660a Mon Sep 17 00:00:00 2001 From: Petr Zemek Date: Tue, 7 Feb 2017 17:33:36 +0100 Subject: [PATCH 1/2] Fix grammar in Chapter 09 ("matches and give" -> "matches and gives") --- src/ch09-02-recoverable-errors-with-result.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ch09-02-recoverable-errors-with-result.md b/src/ch09-02-recoverable-errors-with-result.md index 44639ae0c..91046e8d5 100644 --- a/src/ch09-02-recoverable-errors-with-result.md +++ b/src/ch09-02-recoverable-errors-with-result.md @@ -240,7 +240,7 @@ 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 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 -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 by `error.kind()` is the `NotFound` variant of the `ErrorKind` enum. If it is, From 95b6c1f9deb4225cc73ac4e2cd6c1541dfe4449c Mon Sep 17 00:00:00 2001 From: Petr Zemek Date: Tue, 7 Feb 2017 17:34:47 +0100 Subject: [PATCH 2/2] Fix formatting in Chapter 09 (wrong kind of quotes) Code should be put inside backquotes to make it properly formatted. --- src/ch09-02-recoverable-errors-with-result.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ch09-02-recoverable-errors-with-result.md b/src/ch09-02-recoverable-errors-with-result.md index 91046e8d5..e8c0ffd3c 100644 --- a/src/ch09-02-recoverable-errors-with-result.md +++ b/src/ch09-02-recoverable-errors-with-result.md @@ -244,7 +244,7 @@ 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 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 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