summary refs log tree commit diff
path: root/src/tools/clippy/tests/ui/bytes_nth.fixed
blob: da35fcb55e5a6083f676f1adfef7df8c42d9eefe (plain)
1
2
3
4
5
6
7
8
9
10
#![allow(clippy::unnecessary_operation)]
#![allow(clippy::sliced_string_as_bytes)]
#![warn(clippy::bytes_nth)]

fn main() {
    let s = String::from("String");
    let _ = s.as_bytes().get(3).copied();
    let _ = &s.as_bytes()[3];
    let _ = s[..].as_bytes().get(3).copied();
}