rust-clippy/tests/ui/bytes_nth.fixed

12 lines
216 B
Rust
Raw Normal View History

2021-02-07 16:34:59 +00:00
// run-rustfix
2021-02-10 07:15:29 +00:00
#![allow(clippy::unnecessary_operation)]
2021-02-07 16:34:59 +00:00
#![warn(clippy::bytes_nth)]
fn main() {
2021-02-10 07:15:29 +00:00
let s = String::from("String");
s.as_bytes().get(3);
&s.as_bytes().get(3);
s[..].as_bytes().get(3);
2021-02-07 16:34:59 +00:00
}