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