]> git.lizzy.rs Git - rust.git/blob - tests/ui/iter_skip_next.rs
Auto merge of #3635 - matthiaskrgr:revert_random_state_3603, r=xfix
[rust.git] / tests / ui / iter_skip_next.rs
1 // Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution.
3 //
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.
9
10 // aux-build:option_helpers.rs
11
12 #![warn(clippy::iter_skip_next)]
13 #![allow(clippy::blacklisted_name)]
14
15 extern crate option_helpers;
16
17 use option_helpers::IteratorFalsePositives;
18
19 /// Checks implementation of `ITER_SKIP_NEXT` lint
20 fn iter_skip_next() {
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();
29 }
30
31 fn main() {}