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"); } ```