2023-06-13 18:08:03 +00:00
|
|
|
#![feature(non_exhaustive_omitted_patterns_lint)]
|
|
|
|
#![warn(clippy::match_same_arms)]
|
|
|
|
#![no_main]
|
2023-07-27 11:40:22 +00:00
|
|
|
//@no-rustfix
|
2023-06-13 18:08:03 +00:00
|
|
|
use std::sync::atomic::Ordering; // #[non_exhaustive] enum
|
|
|
|
|
|
|
|
pub fn f(x: Ordering) {
|
|
|
|
match x {
|
|
|
|
Ordering::Relaxed => println!("relaxed"),
|
|
|
|
Ordering::Release => println!("release"),
|
|
|
|
Ordering::Acquire => println!("acquire"),
|
|
|
|
Ordering::AcqRel | Ordering::SeqCst => panic!(),
|
|
|
|
#[deny(non_exhaustive_omitted_patterns)]
|
|
|
|
_ => panic!(),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
mod f {
|
|
|
|
#![deny(non_exhaustive_omitted_patterns)]
|
|
|
|
|
|
|
|
use super::*;
|
|
|
|
|
|
|
|
pub fn f(x: Ordering) {
|
|
|
|
match x {
|
|
|
|
Ordering::Relaxed => println!("relaxed"),
|
|
|
|
Ordering::Release => println!("release"),
|
|
|
|
Ordering::Acquire => println!("acquire"),
|
|
|
|
Ordering::AcqRel | Ordering::SeqCst => panic!(),
|
|
|
|
_ => panic!(),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Below should still lint
|
|
|
|
|
|
|
|
pub fn g(x: Ordering) {
|
|
|
|
match x {
|
|
|
|
Ordering::Relaxed => println!("relaxed"),
|
|
|
|
Ordering::Release => println!("release"),
|
|
|
|
Ordering::Acquire => println!("acquire"),
|
|
|
|
Ordering::AcqRel | Ordering::SeqCst => panic!(),
|
2023-07-28 19:35:48 +00:00
|
|
|
//~^ ERROR: this match arm has an identical body to the `_` wildcard arm
|
2023-06-13 18:08:03 +00:00
|
|
|
_ => panic!(),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
mod g {
|
|
|
|
use super::*;
|
|
|
|
|
|
|
|
pub fn g(x: Ordering) {
|
|
|
|
match x {
|
|
|
|
Ordering::Relaxed => println!("relaxed"),
|
|
|
|
Ordering::Release => println!("release"),
|
|
|
|
Ordering::Acquire => println!("acquire"),
|
|
|
|
Ordering::AcqRel | Ordering::SeqCst => panic!(),
|
2023-07-28 19:35:48 +00:00
|
|
|
//~^ ERROR: this match arm has an identical body to the `_` wildcard arm
|
2023-06-13 18:08:03 +00:00
|
|
|
_ => panic!(),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|