rust-clippy/tests/ui/iter_skip_next.fixed
2020-07-25 17:11:55 +03:00

22 lines
598 B
Rust

// run-rustfix
// aux-build:option_helpers.rs
#![warn(clippy::iter_skip_next)]
#![allow(clippy::blacklisted_name)]
#![allow(clippy::iter_nth)]
extern crate option_helpers;
use option_helpers::IteratorFalsePositives;
/// Checks implementation of `ITER_SKIP_NEXT` lint
fn main() {
let some_vec = vec![0, 1, 2, 3];
let _ = some_vec.iter().nth(42);
let _ = some_vec.iter().cycle().nth(42);
let _ = (1..10).nth(10);
let _ = &some_vec[..].iter().nth(3);
let foo = IteratorFalsePositives { foo: 0 };
let _ = foo.skip(42).next();
let _ = foo.filter().skip(42).next();
}