Move this comment to the first time we use push_str()

This commit is contained in:
Carol (Nichols || Goulding)
2016-07-15 12:32:06 -04:00
parent 5fb35bac81
commit 23d4435073
2 changed files with 4 additions and 4 deletions
+1 -1
View File
@@ -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!`
```
+3 -3
View File
@@ -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");
}
```