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

fn main() {
    let s = String::from("String");
    let _ = s.bytes().nth(3);
    //~^ bytes_nth
    let _ = &s.bytes().nth(3).unwrap();
    //~^ bytes_nth
    let _ = s[..].bytes().nth(3);
    //~^ bytes_nth
}