Skip to content

Commit df57606

Browse files
authored
Use explicit range when slicing into string (#2664)
1 parent b4301e0 commit df57606

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/references/strings.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ fn main() {
2727
s2.push_str(s1);
2828
println!("s2: {s2}");
2929
30-
let s3: &str = &s2[s2.len() - s1.len()..];
30+
let s3: &str = &s2[2..9];
3131
println!("s3: {s3}");
3232
}
3333
```

0 commit comments

Comments
 (0)