summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/tests/ui/bytes_nth.fixed
blob: a35c679afb71f37739b7e0b60dcfa70092a54e06 (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();
}