2018-10-30 20:36:52 +00:00
|
|
|
#![feature(exclusive_range_pattern)]
|
|
|
|
#![warn(clippy::match_overlapping_arm)]
|
|
|
|
#![allow(clippy::redundant_pattern_matching)]
|
|
|
|
|
|
|
|
/// Tests for match_overlapping_arm
|
|
|
|
|
|
|
|
fn overlapping() {
|
2018-12-09 22:26:16 +00:00
|
|
|
const FOO: u64 = 2;
|
2018-10-30 20:36:52 +00:00
|
|
|
|
|
|
|
match 42 {
|
2019-06-01 05:54:47 +00:00
|
|
|
0..=10 => println!("0 ... 10"),
|
|
|
|
0..=11 => println!("0 ... 11"),
|
2018-10-30 20:36:52 +00:00
|
|
|
_ => (),
|
|
|
|
}
|
|
|
|
|
|
|
|
match 42 {
|
2019-06-01 05:54:47 +00:00
|
|
|
0..=5 => println!("0 ... 5"),
|
|
|
|
6..=7 => println!("6 ... 7"),
|
|
|
|
FOO..=11 => println!("0 ... 11"),
|
2018-10-30 20:36:52 +00:00
|
|
|
_ => (),
|
|
|
|
}
|
|
|
|
|
|
|
|
match 42 {
|
|
|
|
2 => println!("2"),
|
2019-06-01 05:54:47 +00:00
|
|
|
0..=5 => println!("0 ... 5"),
|
2018-10-30 20:36:52 +00:00
|
|
|
_ => (),
|
|
|
|
}
|
|
|
|
|
|
|
|
match 42 {
|
|
|
|
2 => println!("2"),
|
2019-06-01 05:54:47 +00:00
|
|
|
0..=2 => println!("0 ... 2"),
|
2018-10-30 20:36:52 +00:00
|
|
|
_ => (),
|
|
|
|
}
|
|
|
|
|
|
|
|
match 42 {
|
2019-06-01 05:54:47 +00:00
|
|
|
0..=10 => println!("0 ... 10"),
|
|
|
|
11..=50 => println!("11 ... 50"),
|
2018-10-30 20:36:52 +00:00
|
|
|
_ => (),
|
|
|
|
}
|
|
|
|
|
|
|
|
match 42 {
|
|
|
|
2 => println!("2"),
|
2018-12-09 22:26:16 +00:00
|
|
|
0..2 => println!("0 .. 2"),
|
2018-10-30 20:36:52 +00:00
|
|
|
_ => (),
|
|
|
|
}
|
|
|
|
|
|
|
|
match 42 {
|
2018-12-09 22:26:16 +00:00
|
|
|
0..10 => println!("0 .. 10"),
|
|
|
|
10..50 => println!("10 .. 50"),
|
2018-10-30 20:36:52 +00:00
|
|
|
_ => (),
|
|
|
|
}
|
|
|
|
|
|
|
|
match 42 {
|
2018-12-09 22:26:16 +00:00
|
|
|
0..11 => println!("0 .. 11"),
|
2019-06-01 05:54:47 +00:00
|
|
|
0..=11 => println!("0 ... 11"),
|
2018-10-30 20:36:52 +00:00
|
|
|
_ => (),
|
|
|
|
}
|
|
|
|
|
|
|
|
if let None = Some(42) {
|
|
|
|
// nothing
|
|
|
|
} else if let None = Some(42) {
|
|
|
|
// another nothing :-)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {}
|