mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-12-11 22:02:55 +00:00
14 lines
515 B
Rust
14 lines
515 B
Rust
#[warn(clippy::string_slice)]
|
|
#[allow(clippy::no_effect)]
|
|
|
|
fn main() {
|
|
&"Ölkanne"[1..];
|
|
//~^ ERROR: indexing into a string may panic if the index is within a UTF-8 character
|
|
//~| NOTE: `-D clippy::string-slice` implied by `-D warnings`
|
|
let m = "Mötörhead";
|
|
&m[2..5];
|
|
//~^ ERROR: indexing into a string may panic if the index is within a UTF-8 character
|
|
let s = String::from(m);
|
|
&s[0..2];
|
|
//~^ ERROR: indexing into a string may panic if the index is within a UTF-8 character
|
|
}
|