From 09909d27d6a2a176a32ac5fdce063102fc1b6186 Mon Sep 17 00:00:00 2001 From: Zachary T Jones Date: Wed, 27 Jul 2016 20:29:17 -0400 Subject: [PATCH 1/2] Fix typos/grammar and markdown link syntax --- src/ch04-02-ownership.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ch04-02-ownership.md b/src/ch04-02-ownership.md index 5083c135d..e43ff22f1 100644 --- a/src/ch04-02-ownership.md +++ b/src/ch04-02-ownership.md @@ -206,7 +206,7 @@ it only works for memory. What if, instead of a `String`, we had a `TcpConnection`? Opening and closing a network connection is very similar to allocating and freeing memory. The solution that we could use there is to allow the programmer to hook into the assignment, similar to `drop()`, and write code -fix things up. That would work, but now, an `=` can run arbitrary code. That’s +to fix things up. That would work, but now, an `=` can run arbitrary code. That’s also not good, and it doesn’t solve our efficiency concerns either. Let’s take a step back: the root of the problem is that `s1` and `s2` both @@ -258,7 +258,7 @@ inexpensive. But what if we _do_ want to deeply copy the `String`’s data, and not just the `String` itself? There’s a common method for that: `clone()`. We will discuss -methods in the next section on [`struct`]s, but they’re a common enough feature +methods in the next section on [structs][struct], but they’re a common enough feature in many programming languages that you have probably seen them before. Here’s an example of the `clone()` method in action: @@ -270,7 +270,7 @@ let s2 = s1.clone(); println!("{}", s1); ``` -[`struct`]: structs.html +[struct]: structs.html This will work just fine. Remember our diagram from before? In this case, it _is_ doing this: @@ -442,7 +442,7 @@ owner goes out of scope, if it hasn’t been moved, it will `drop()`. This might seem a bit tedious, and it is. What if I want to let a function use a value, but not take ownership? It’s quite annoying that anything I pass in -also needs passed back. Look at this function: +also needs to be passed back. Look at this function: ```rust fn main() { From 0adad8df42dfd2b4f762d1c2fd7980b1ffca0454 Mon Sep 17 00:00:00 2001 From: Zachary T Jones Date: Thu, 28 Jul 2016 13:08:42 -0400 Subject: [PATCH 2/2] Update link to structs chapter --- src/ch04-02-ownership.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ch04-02-ownership.md b/src/ch04-02-ownership.md index e43ff22f1..adb141964 100644 --- a/src/ch04-02-ownership.md +++ b/src/ch04-02-ownership.md @@ -258,7 +258,7 @@ inexpensive. But what if we _do_ want to deeply copy the `String`’s data, and not just the `String` itself? There’s a common method for that: `clone()`. We will discuss -methods in the next section on [structs][struct], but they’re a common enough feature +methods in the next section on [structs], but they’re a common enough feature in many programming languages that you have probably seen them before. Here’s an example of the `clone()` method in action: @@ -270,7 +270,7 @@ let s2 = s1.clone(); println!("{}", s1); ``` -[struct]: structs.html +[structs]: ch05-01-structs.html This will work just fine. Remember our diagram from before? In this case, it _is_ doing this: