From 23d44350737beaaa89c85515fcb652f137fae87e Mon Sep 17 00:00:00 2001 From: "Carol (Nichols || Goulding)" Date: Thu, 14 Jul 2016 18:22:19 -0400 Subject: [PATCH] Move this comment to the first time we use `push_str()` --- src/ch04-02-ownership.md | 2 +- src/ch04-03-references-and-borrowing.md | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ch04-02-ownership.md b/src/ch04-02-ownership.md index c487660ef..e4103572d 100644 --- a/src/ch04-02-ownership.md +++ b/src/ch04-02-ownership.md @@ -77,7 +77,7 @@ This kind of string can be mutated: ```rust let mut s = String::from("hello"); -s.push_str(", world!"); +s.push_str(", world!"); // push_str() appends a literal to a String println!("{}", s); // This will print `hello, world!` ``` diff --git a/src/ch04-03-references-and-borrowing.md b/src/ch04-03-references-and-borrowing.md index 113215534..4f2c819e2 100644 --- a/src/ch04-03-references-and-borrowing.md +++ b/src/ch04-03-references-and-borrowing.md @@ -100,7 +100,7 @@ fn main() { } fn change(some_string: &String) { - some_string.push_str(", world"); // push_str() appends a literal to a String + some_string.push_str(", world"); } ``` @@ -108,7 +108,7 @@ Here’s the error: ```text 8:16 error: cannot borrow immutable borrowed content `*some_string` as mutable - some_string.push_str(", world"); // push_str() appends a literal to a String + some_string.push_str(", world"); ^~~~~~~~~~~ ``` @@ -127,7 +127,7 @@ fn main() { } fn change(some_string: &mut String) { - some_string.push_str(", world"); // push_str() appends a literal to a String + some_string.push_str(", world"); } ```