mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-30 16:39:26 +00:00
54 lines
798 B
Rust
54 lines
798 B
Rust
//@compile-flags: --test
|
|
#![warn(clippy::panic)]
|
|
|
|
fn main() {
|
|
enum Enam {
|
|
A,
|
|
}
|
|
let a = Enam::A;
|
|
match a {
|
|
Enam::A => {},
|
|
_ => panic!(""),
|
|
}
|
|
}
|
|
|
|
#[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!(""),
|
|
}
|
|
}
|
|
}
|