1 // Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution.
4 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
5 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
6 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
7 // option. This file may not be copied, modified, or distributed
8 // except according to those terms.
10 // aux-build:option_helpers.rs
12 #![warn(clippy::iter_skip_next)]
13 #![allow(clippy::blacklisted_name)]
15 extern crate option_helpers;
17 use option_helpers::IteratorFalsePositives;
19 /// Checks implementation of `ITER_SKIP_NEXT` lint
21 let mut some_vec = vec![0, 1, 2, 3];
22 let _ = some_vec.iter().skip(42).next();
23 let _ = some_vec.iter().cycle().skip(42).next();
24 let _ = (1..10).skip(10).next();
25 let _ = &some_vec[..].iter().skip(3).next();
26 let foo = IteratorFalsePositives { foo: 0 };
27 let _ = foo.skip(42).next();
28 let _ = foo.filter().skip(42).next();