2020-08-11 13:43:21 +00:00
|
|
|
// run-rustfix
|
2019-01-02 21:48:44 +00:00
|
|
|
// aux-build:option_helpers.rs
|
|
|
|
|
2018-12-30 11:41:37 +00:00
|
|
|
#![warn(clippy::iter_skip_next)]
|
|
|
|
#![allow(clippy::blacklisted_name)]
|
2020-08-11 13:43:21 +00:00
|
|
|
#![allow(clippy::iter_nth)]
|
2018-12-30 11:41:37 +00:00
|
|
|
|
2019-01-02 21:48:44 +00:00
|
|
|
extern crate option_helpers;
|
|
|
|
|
|
|
|
use option_helpers::IteratorFalsePositives;
|
2018-12-30 11:41:37 +00:00
|
|
|
|
|
|
|
/// Checks implementation of `ITER_SKIP_NEXT` lint
|
2020-08-11 13:43:21 +00:00
|
|
|
fn main() {
|
|
|
|
let some_vec = vec![0, 1, 2, 3];
|
2018-12-30 11:41:37 +00:00
|
|
|
let _ = some_vec.iter().skip(42).next();
|
|
|
|
let _ = some_vec.iter().cycle().skip(42).next();
|
|
|
|
let _ = (1..10).skip(10).next();
|
|
|
|
let _ = &some_vec[..].iter().skip(3).next();
|
|
|
|
let foo = IteratorFalsePositives { foo: 0 };
|
|
|
|
let _ = foo.skip(42).next();
|
|
|
|
let _ = foo.filter().skip(42).next();
|
|
|
|
}
|