1
0
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:
Nicole L 2025-02-27 12:29:44 -08:00 committed by GitHub
parent b4301e06c4
commit df57606996
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

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