2021-11-04 07:52:36 -05:00
|
|
|
#[warn(clippy::string_slice)]
|
|
|
|
#[allow(clippy::no_effect)]
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
&"Ölkanne"[1..];
|
2023-08-24 14:32:12 -05:00
|
|
|
//~^ 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`
|
2021-11-04 07:52:36 -05:00
|
|
|
let m = "Mötörhead";
|
|
|
|
&m[2..5];
|
2023-08-24 14:32:12 -05:00
|
|
|
//~^ ERROR: indexing into a string may panic if the index is within a UTF-8 character
|
2021-11-04 07:52:36 -05:00
|
|
|
let s = String::from(m);
|
|
|
|
&s[0..2];
|
2023-08-24 14:32:12 -05:00
|
|
|
//~^ ERROR: indexing into a string may panic if the index is within a UTF-8 character
|
2021-11-04 07:52:36 -05:00
|
|
|
}
|