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.
11 #![feature(tool_lints)]
15 fn step_by(&self, _: u32) {}
18 #[warn(clippy::iterator_step_by_zero, clippy::range_zip_with_len)]
20 let _ = (0..1).step_by(0);
21 // No warning for non-zero step
22 let _ = (0..1).step_by(1);
24 let _ = (1..).step_by(0);
25 let _ = (1..=2).step_by(0);
30 // No error, not a range.
36 let _x = v1.iter().zip(0..v1.len());
37 let _y = v1.iter().zip(0..v2.len()); // No error
40 let _ = v1.iter().step_by(2/3);
44 fn no_panic_with_fake_range_types() {
49 let _ = Range { foo: 0 };