rust/tests/ui/range.rs

18 lines
360 B
Rust
Raw Normal View History

2023-06-06 15:56:57 -05:00
#![allow(clippy::useless_vec)]
#[warn(clippy::range_zip_with_len)]
fn main() {
2018-12-09 16:26:16 -06:00
let v1 = vec![1, 2, 3];
let v2 = vec![4, 5];
2017-02-08 07:58:07 -06:00
let _x = v1.iter().zip(0..v1.len());
let _y = v1.iter().zip(0..v2.len()); // No error
}
2017-10-12 09:24:21 -05:00
#[allow(unused)]
fn no_panic_with_fake_range_types() {
struct Range {
foo: i32,
}
let _ = Range { foo: 0 };
}