mirror of
https://github.com/google/comprehensive-rust.git
synced 2025-05-15 15:16:51 +02:00
Use explicit range when slicing into string (#2664)
This commit is contained in:
parent
b4301e06c4
commit
df57606996
@ -27,7 +27,7 @@ fn main() {
|
|||||||
s2.push_str(s1);
|
s2.push_str(s1);
|
||||||
println!("s2: {s2}");
|
println!("s2: {s2}");
|
||||||
|
|
||||||
let s3: &str = &s2[s2.len() - s1.len()..];
|
let s3: &str = &s2[2..9];
|
||||||
println!("s3: {s3}");
|
println!("s3: {s3}");
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
Loading…
x
Reference in New Issue
Block a user