2024-05-15 05:59:35 -05:00
|
|
|
//@compile-flags: --test
|
|
|
|
#![warn(clippy::panic)]
|
2024-08-24 09:29:11 -05:00
|
|
|
use std::panic::panic_any;
|
2024-05-15 05:59:35 -05:00
|
|
|
|
|
|
|
fn main() {
|
|
|
|
enum Enam {
|
|
|
|
A,
|
|
|
|
}
|
|
|
|
let a = Enam::A;
|
|
|
|
match a {
|
|
|
|
Enam::A => {},
|
|
|
|
_ => panic!(""),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-08-24 09:29:11 -05:00
|
|
|
fn issue_13292() {
|
|
|
|
panic_any("should lint")
|
|
|
|
}
|
|
|
|
|
2024-05-15 05:59:35 -05:00
|
|
|
#[test]
|
|
|
|
fn lonely_test() {
|
|
|
|
enum Enam {
|
|
|
|
A,
|
|
|
|
}
|
|
|
|
let a = Enam::A;
|
|
|
|
match a {
|
|
|
|
Enam::A => {},
|
|
|
|
_ => panic!(""),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[cfg(test)]
|
|
|
|
mod tests {
|
|
|
|
// should not lint in `#[cfg(test)]` modules
|
|
|
|
#[test]
|
|
|
|
fn test_fn() {
|
|
|
|
enum Enam {
|
|
|
|
A,
|
|
|
|
}
|
|
|
|
let a = Enam::A;
|
|
|
|
match a {
|
|
|
|
Enam::A => {},
|
|
|
|
_ => panic!(""),
|
|
|
|
}
|
|
|
|
|
|
|
|
bar();
|
|
|
|
}
|
|
|
|
|
|
|
|
fn bar() {
|
|
|
|
enum Enam {
|
|
|
|
A,
|
|
|
|
}
|
|
|
|
let a = Enam::A;
|
|
|
|
match a {
|
|
|
|
Enam::A => {},
|
|
|
|
_ => panic!(""),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|