2022-06-04 06:34:07 -05:00
|
|
|
// run-rustfix
|
|
|
|
// edition:2018
|
2022-09-21 12:02:37 -05:00
|
|
|
// aux-build:macro_rules.rs
|
2022-06-04 06:34:07 -05:00
|
|
|
|
|
|
|
#![feature(exclusive_range_pattern)]
|
|
|
|
#![feature(stmt_expr_attributes)]
|
2022-12-17 07:12:54 -06:00
|
|
|
#![warn(clippy::almost_complete_range)]
|
2022-06-04 06:34:07 -05:00
|
|
|
#![allow(ellipsis_inclusive_range_patterns)]
|
2022-06-16 10:39:06 -05:00
|
|
|
#![allow(clippy::needless_parens_on_range_literals)]
|
2022-12-17 07:12:54 -06:00
|
|
|
#![allow(clippy::double_parens)]
|
2022-06-04 06:34:07 -05:00
|
|
|
|
2022-09-21 12:02:37 -05:00
|
|
|
#[macro_use]
|
|
|
|
extern crate macro_rules;
|
|
|
|
|
2022-06-04 06:34:07 -05:00
|
|
|
macro_rules! a {
|
|
|
|
() => {
|
|
|
|
'a'
|
|
|
|
};
|
|
|
|
}
|
2022-12-17 07:12:54 -06:00
|
|
|
macro_rules! A {
|
|
|
|
() => {
|
|
|
|
'A'
|
|
|
|
};
|
|
|
|
}
|
|
|
|
macro_rules! zero {
|
|
|
|
() => {
|
|
|
|
'0'
|
|
|
|
};
|
|
|
|
}
|
2022-06-04 06:34:07 -05:00
|
|
|
|
2022-09-21 12:02:37 -05:00
|
|
|
macro_rules! b {
|
|
|
|
() => {
|
|
|
|
let _ = 'a'..='z';
|
2022-12-17 07:12:54 -06:00
|
|
|
let _ = 'A'..='Z';
|
|
|
|
let _ = '0'..='9';
|
2022-09-21 12:02:37 -05:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2022-06-04 06:34:07 -05:00
|
|
|
fn main() {
|
|
|
|
#[rustfmt::skip]
|
|
|
|
{
|
|
|
|
let _ = ('a') ..='z';
|
|
|
|
let _ = 'A' ..= ('Z');
|
2022-12-17 07:12:54 -06:00
|
|
|
let _ = ((('0'))) ..= ('9');
|
2022-06-04 06:34:07 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
let _ = 'b'..'z';
|
|
|
|
let _ = 'B'..'Z';
|
2022-12-17 07:12:54 -06:00
|
|
|
let _ = '1'..'9';
|
2022-06-04 06:34:07 -05:00
|
|
|
|
|
|
|
let _ = (b'a')..=(b'z');
|
|
|
|
let _ = b'A'..=b'Z';
|
2022-12-17 07:12:54 -06:00
|
|
|
let _ = b'0'..=b'9';
|
2022-06-04 06:34:07 -05:00
|
|
|
|
|
|
|
let _ = b'b'..b'z';
|
|
|
|
let _ = b'B'..b'Z';
|
2022-12-17 07:12:54 -06:00
|
|
|
let _ = b'1'..b'9';
|
2022-06-04 06:34:07 -05:00
|
|
|
|
|
|
|
let _ = a!()..='z';
|
2022-12-17 07:12:54 -06:00
|
|
|
let _ = A!()..='Z';
|
|
|
|
let _ = zero!()..='9';
|
2022-06-04 06:34:07 -05:00
|
|
|
|
|
|
|
let _ = match 0u8 {
|
|
|
|
b'a'..=b'z' if true => 1,
|
|
|
|
b'A'..=b'Z' if true => 2,
|
2022-12-17 07:12:54 -06:00
|
|
|
b'0'..=b'9' if true => 3,
|
|
|
|
b'b'..b'z' => 4,
|
|
|
|
b'B'..b'Z' => 5,
|
|
|
|
b'1'..b'9' => 6,
|
|
|
|
_ => 7,
|
2022-06-04 06:34:07 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
let _ = match 'x' {
|
|
|
|
'a'..='z' if true => 1,
|
|
|
|
'A'..='Z' if true => 2,
|
2022-12-17 07:12:54 -06:00
|
|
|
'0'..='9' if true => 3,
|
|
|
|
'b'..'z' => 4,
|
|
|
|
'B'..'Z' => 5,
|
|
|
|
'1'..'9' => 6,
|
|
|
|
_ => 7,
|
2022-06-04 06:34:07 -05:00
|
|
|
};
|
2022-09-21 12:02:37 -05:00
|
|
|
|
2022-12-17 07:12:54 -06:00
|
|
|
almost_complete_range!();
|
2022-09-21 12:02:37 -05:00
|
|
|
b!();
|
2022-06-04 06:34:07 -05:00
|
|
|
}
|
|
|
|
|
2022-12-01 11:29:38 -06:00
|
|
|
#[clippy::msrv = "1.25"]
|
2022-06-04 06:34:07 -05:00
|
|
|
fn _under_msrv() {
|
|
|
|
let _ = match 'a' {
|
|
|
|
'a'...'z' => 1,
|
2022-12-17 07:12:54 -06:00
|
|
|
'A'...'Z' => 2,
|
|
|
|
'0'...'9' => 3,
|
|
|
|
_ => 4,
|
2022-06-04 06:34:07 -05:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2022-12-01 11:29:38 -06:00
|
|
|
#[clippy::msrv = "1.26"]
|
2022-06-04 06:34:07 -05:00
|
|
|
fn _meets_msrv() {
|
|
|
|
let _ = 'a'..='z';
|
2022-12-17 07:12:54 -06:00
|
|
|
let _ = 'A'..='Z';
|
|
|
|
let _ = '0'..='9';
|
2022-06-04 06:34:07 -05:00
|
|
|
let _ = match 'a' {
|
|
|
|
'a'..='z' => 1,
|
2022-12-17 07:12:54 -06:00
|
|
|
'A'..='Z' => 1,
|
|
|
|
'0'..='9' => 3,
|
|
|
|
_ => 4,
|
2022-06-04 06:34:07 -05:00
|
|
|
};
|
|
|
|
}
|