2021-01-21 15:41:57 -06:00
|
|
|
#![deny(clippy::exhaustive_enums, clippy::exhaustive_structs)]
|
2021-01-21 14:48:30 -06:00
|
|
|
#![allow(unused)]
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
// nop
|
|
|
|
}
|
|
|
|
|
2021-01-21 15:41:57 -06:00
|
|
|
pub mod enums {
|
|
|
|
#[non_exhaustive]
|
2021-01-21 16:00:25 -06:00
|
|
|
pub enum Exhaustive {
|
2021-01-21 15:41:57 -06:00
|
|
|
Foo,
|
|
|
|
Bar,
|
|
|
|
Baz,
|
|
|
|
Quux(String),
|
|
|
|
}
|
2021-01-21 14:48:30 -06:00
|
|
|
|
2021-01-25 16:39:03 -06:00
|
|
|
/// Some docs
|
|
|
|
#[repr(C)]
|
|
|
|
#[non_exhaustive]
|
|
|
|
pub enum ExhaustiveWithAttrs {
|
|
|
|
Foo,
|
|
|
|
Bar,
|
|
|
|
Baz,
|
|
|
|
Quux(String),
|
|
|
|
}
|
|
|
|
|
2021-01-21 15:41:57 -06:00
|
|
|
// no warning, already non_exhaustive
|
|
|
|
#[non_exhaustive]
|
|
|
|
pub enum NonExhaustive {
|
|
|
|
Foo,
|
|
|
|
Bar,
|
|
|
|
Baz,
|
|
|
|
Quux(String),
|
|
|
|
}
|
|
|
|
|
|
|
|
// no warning, private
|
|
|
|
enum ExhaustivePrivate {
|
|
|
|
Foo,
|
|
|
|
Bar,
|
|
|
|
Baz,
|
|
|
|
Quux(String),
|
|
|
|
}
|
2021-01-21 15:34:44 -06:00
|
|
|
|
2021-01-21 15:41:57 -06:00
|
|
|
// no warning, private
|
|
|
|
#[non_exhaustive]
|
|
|
|
enum NonExhaustivePrivate {
|
|
|
|
Foo,
|
|
|
|
Bar,
|
|
|
|
Baz,
|
|
|
|
Quux(String),
|
|
|
|
}
|
2021-01-21 15:34:44 -06:00
|
|
|
}
|
|
|
|
|
2021-01-21 15:41:57 -06:00
|
|
|
pub mod structs {
|
|
|
|
#[non_exhaustive]
|
2021-01-21 16:00:25 -06:00
|
|
|
pub struct Exhaustive {
|
2021-02-01 20:38:43 -06:00
|
|
|
pub foo: u8,
|
|
|
|
pub bar: String,
|
2021-01-21 15:41:57 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
// no warning, already non_exhaustive
|
|
|
|
#[non_exhaustive]
|
|
|
|
pub struct NonExhaustive {
|
2021-02-01 20:38:43 -06:00
|
|
|
pub foo: u8,
|
|
|
|
pub bar: String,
|
|
|
|
}
|
|
|
|
|
|
|
|
// no warning, private fields
|
|
|
|
pub struct ExhaustivePrivateFieldTuple(u8);
|
|
|
|
|
|
|
|
// no warning, private fields
|
|
|
|
pub struct ExhaustivePrivateField {
|
|
|
|
pub foo: u8,
|
2021-02-02 01:59:23 -06:00
|
|
|
bar: String,
|
2021-01-21 15:41:57 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
// no warning, private
|
|
|
|
struct ExhaustivePrivate {
|
2021-02-01 20:38:43 -06:00
|
|
|
pub foo: u8,
|
|
|
|
pub bar: String,
|
2021-01-21 15:41:57 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
// no warning, private
|
|
|
|
#[non_exhaustive]
|
|
|
|
struct NonExhaustivePrivate {
|
2021-02-01 20:38:43 -06:00
|
|
|
pub foo: u8,
|
|
|
|
pub bar: String,
|
2021-01-21 15:41:57 -06:00
|
|
|
}
|
2021-01-21 14:48:30 -06:00
|
|
|
}
|