2 #![warn(clippy::reversed_empty_ranges)]
4 const ANSWER: i32 = 42;
7 // These should be linted:
9 (42..=21).for_each(|x| println!("{}", x));
10 let _ = (ANSWER..21).filter(|x| x % 2 == 0).take(10).collect::<Vec<_>>();
13 for _ in 42u32..21u32 {}
15 // These should be ignored as they are not empty ranges:
17 (21..=42).for_each(|x| println!("{}", x));
18 (21..42).for_each(|x| println!("{}", x));
20 let arr = [1, 2, 3, 4, 5];
27 // This range is empty but should be ignored, see issue #5689