mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-10 15:14:29 +00:00
e097fca4df
Move `iterator_step_by_zero` into `methods` since it applies to all iterators and not just ranges. Simplify the code while doing so.
16 lines
329 B
Rust
16 lines
329 B
Rust
#[warn(clippy::range_zip_with_len)]
|
|
fn main() {
|
|
let v1 = vec![1, 2, 3];
|
|
let v2 = vec![4, 5];
|
|
let _x = v1.iter().zip(0..v1.len());
|
|
let _y = v1.iter().zip(0..v2.len()); // No error
|
|
}
|
|
|
|
#[allow(unused)]
|
|
fn no_panic_with_fake_range_types() {
|
|
struct Range {
|
|
foo: i32,
|
|
}
|
|
|
|
let _ = Range { foo: 0 };
|
|
}
|