Skip to content

Commit d0b951b

Browse files
committed
Avoid calling a variable 'string' when discussing strings.
Newcomers to Rust need to learn the distinctinion between `&str` and `String`, so additonally having `string` in an example risks confusion.
1 parent 63b000b commit d0b951b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/doc/trpl/strings.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Rust has two main types of strings: `&str` and `String`. Let’s talk about
1616
`&'static str`:
1717

1818
```rust
19-
let string = "Hello there."; // string: &'static str
19+
let greeting = "Hello there."; // greeting: &'static str
2020
```
2121

2222
This string is statically allocated, meaning that it’s saved inside our

0 commit comments

Comments
 (0)