summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/tests/ui/bytes_nth.fixed
blob: d3e0f676b29f97141f81eec156e5948c4e7d96c1 (plain)
1
2
3
4
5
6
7
8
9
10
11
//@run-rustfix

#![allow(clippy::unnecessary_operation)]
#![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();
}