mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-12-24 03:53:20 +00:00
59 lines
876 B
Rust
59 lines
876 B
Rust
//@compile-flags: --test
|
|
#![warn(clippy::panic)]
|
|
use std::panic::panic_any;
|
|
|
|
fn main() {
|
|
enum Enam {
|
|
A,
|
|
}
|
|
let a = Enam::A;
|
|
match a {
|
|
Enam::A => {},
|
|
_ => panic!(""),
|
|
}
|
|
}
|
|
|
|
fn issue_13292() {
|
|
panic_any("should lint")
|
|
}
|
|
|
|
#[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!(""),
|
|
}
|
|
}
|
|
}
|