rust/tests/ui/exhaustive_items.rs

42 lines
507 B
Rust
Raw Normal View History

2021-01-21 14:48:30 -06:00
// run-rustfix
#![deny(clippy::exhaustive_enums)]
#![allow(unused)]
fn main() {
// nop
}
pub enum Exhaustive {
2021-01-21 14:48:30 -06:00
Foo,
Bar,
Baz,
Quux(String),
}
// no warning, already non_exhaustive
2021-01-21 14:48:30 -06:00
#[non_exhaustive]
pub enum NonExhaustive {
Foo,
Bar,
Baz,
Quux(String),
}
// no warning, private
enum ExhaustivePrivate {
Foo,
Bar,
Baz,
Quux(String),
}
// no warning, private
#[non_exhaustive]
enum NonExhaustivePrivate {
2021-01-21 14:48:30 -06:00
Foo,
Bar,
Baz,
Quux(String),
}