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.
12 fn step_by(&self, _: u32) {}
15 #[warn(clippy::iterator_step_by_zero, clippy::range_zip_with_len)]
17 let _ = (0..1).step_by(0);
18 // No warning for non-zero step
19 let _ = (0..1).step_by(1);
21 let _ = (1..).step_by(0);
22 let _ = (1..=2).step_by(0);
27 // No error, not a range.
31 let v1 = vec![1, 2, 3];
33 let _x = v1.iter().zip(0..v1.len());
34 let _y = v1.iter().zip(0..v2.len()); // No error
37 let _ = v1.iter().step_by(2 / 3);
41 fn no_panic_with_fake_range_types() {
46 let _ = Range { foo: 0 };