mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-12-21 02:23:19 +00:00
55 lines
798 B
Rust
55 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!(""),
|
||
|
}
|
||
|
}
|
||
|
}
|