From fa7ba34dd2d3e5247cd18c6e34656c07cf1a3eb0 Mon Sep 17 00:00:00 2001 From: David Wickes Date: Sun, 12 Mar 2017 14:20:17 +0000 Subject: [PATCH 1/3] fixes missing reference to ch 13 --- .../src/ch12-03-improving-error-handling-and-modularity.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/second-edition/src/ch12-03-improving-error-handling-and-modularity.md b/second-edition/src/ch12-03-improving-error-handling-and-modularity.md index ffcdb7779..716d7ecf0 100644 --- a/second-edition/src/ch12-03-improving-error-handling-and-modularity.md +++ b/second-edition/src/ch12-03-improving-error-handling-and-modularity.md @@ -163,9 +163,9 @@ code very straightforward. > #### The Tradeoffs of Using `clone` > > There's a tendency amongst many Rustaceans to prefer not to use `clone` to fix -> ownership problems due to its runtime cost. In Chapter XX on iterators, we'll -> learn how to make this situation more efficient. For now, it's okay to copy a -> few strings to keep making progress. We're only going to be making these +> ownership problems due to its runtime cost. In Chapter 13 we'll learn how to +> make this situation more efficient with iterators. For now, it's okay to copy +> a few strings to keep making progress. We're only going to be making these > copies once, and our filename and search string are both very small. It's > better to have a working program that's a bit inefficient than try to > hyper-optimize code on your first pass. As you get more experienced with Rust, From de25f6e3901da951ac422c3c308c21f96df813ec Mon Sep 17 00:00:00 2001 From: David Wickes Date: Sun, 12 Mar 2017 18:07:16 +0000 Subject: [PATCH 2/3] fixes another missing reference to chapter 13 --- .../src/ch12-03-improving-error-handling-and-modularity.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/second-edition/src/ch12-03-improving-error-handling-and-modularity.md b/second-edition/src/ch12-03-improving-error-handling-and-modularity.md index 716d7ecf0..debd11873 100644 --- a/second-edition/src/ch12-03-improving-error-handling-and-modularity.md +++ b/second-edition/src/ch12-03-improving-error-handling-and-modularity.md @@ -343,7 +343,7 @@ by the standard library: `unwrap_or_else`. This method has similar behavior as `unwrap` if the `Result` is an `Ok` value: it returns the inner value `Ok` is wrapping. Unlike `unwrap`, if the value is an `Err` value, this method calls a *closure* which is an anonymous function that we define and pass as an argument -to `unwrap_or_else`. We'll be covering closures in more detail in Chapter XX; +to `unwrap_or_else`. We'll be covering closures in more detail in Chapter 13; the important part to understand in this case is that `unwrap_or_else` will pass the inner value of the `Err` to our closure in the parameter `err` that appears between the vertical pipes. Using `unwrap_or_else` lets us do some From bdab3f38da5b7bf7277bfe21ec59a7a81880e6b4 Mon Sep 17 00:00:00 2001 From: David Wickes Date: Sun, 12 Mar 2017 18:48:36 +0000 Subject: [PATCH 3/3] fix reference to Box chapter --- .../src/ch12-03-improving-error-handling-and-modularity.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/second-edition/src/ch12-03-improving-error-handling-and-modularity.md b/second-edition/src/ch12-03-improving-error-handling-and-modularity.md index debd11873..66070446f 100644 --- a/second-edition/src/ch12-03-improving-error-handling-and-modularity.md +++ b/second-edition/src/ch12-03-improving-error-handling-and-modularity.md @@ -443,7 +443,7 @@ which we'll be covering in Chapter XX. For now, think of it like this: the `Error` trait, but we're not specifying what particular type the return value will be. This gives us flexibility to return error values that may be of different types in different error cases. `Box` is a smart pointer to heap -data, and we'll be going into detail about `Box` in Chapter YY. +data, and we'll be going into detail about `Box` in Chapter 15. The second change is that we've removed our calls to `expect` in favor of `?`, like we talked about in Chapter 9. Rather than `panic!` on an error, this will