2023-06-16 19:39:02 +00:00
|
|
|
#![allow(unused)]
|
2023-06-20 08:51:39 +00:00
|
|
|
#![warn(clippy::manual_range_patterns)]
|
2023-06-16 19:39:02 +00:00
|
|
|
#![feature(exclusive_range_pattern)]
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let f = 6;
|
|
|
|
|
|
|
|
let _ = matches!(f, 1..=10);
|
|
|
|
let _ = matches!(f, 1..=10);
|
|
|
|
let _ = matches!(f, 4 | 2 | 3 | 1 | 5 | 6 | 9 | 8 | 10); // 7 is missing
|
|
|
|
let _ = matches!(f, | 4);
|
|
|
|
let _ = matches!(f, 4 | 5);
|
|
|
|
let _ = matches!(f, 1 | 2147483647);
|
|
|
|
let _ = matches!(f, 0 | 2147483647);
|
|
|
|
let _ = matches!(f, -2147483647 | 2147483647);
|
|
|
|
let _ = matches!(f, 1 | (2..=4));
|
|
|
|
let _ = matches!(f, 1 | (2..4));
|
|
|
|
let _ = matches!(f, 1..=48324729);
|
|
|
|
let _ = matches!(f, 0..=48324730);
|
|
|
|
let _ = matches!(f, 0..=3);
|
|
|
|
#[allow(clippy::match_like_matches_macro)]
|
|
|
|
let _ = match f {
|
|
|
|
1..=10 => true,
|
|
|
|
_ => false,
|
|
|
|
};
|
2023-07-03 18:24:14 +00:00
|
|
|
let _ = matches!(f, -5..=3);
|
|
|
|
let _ = matches!(f, -1 | -5 | 3 | -2 | -4 | -3 | 0 | 1); // 2 is missing
|
|
|
|
let _ = matches!(f, -1000001..=1000001);
|
|
|
|
let _ = matches!(f, -1_000_000..=1_000_000 | -1_000_001 | 1_000_002);
|
2023-06-16 19:39:02 +00:00
|
|
|
|
|
|
|
macro_rules! mac {
|
|
|
|
($e:expr) => {
|
|
|
|
matches!($e, 1..=10)
|
|
|
|
};
|
|
|
|
}
|
|
|
|
mac!(f);
|
|
|
|
}
|