mirror of
https://github.com/rust-lang/rust.git
synced 2024-10-31 22:41:50 +00:00
80 lines
1.2 KiB
Rust
80 lines
1.2 KiB
Rust
|
// run-rustfix
|
||
|
|
||
|
#![deny(clippy::exhaustive_enums, clippy::exhaustive_structs)]
|
||
|
#![allow(unused)]
|
||
|
|
||
|
fn main() {
|
||
|
// nop
|
||
|
}
|
||
|
|
||
|
pub mod enums {
|
||
|
pub enum Exhaustive {
|
||
|
Foo,
|
||
|
Bar,
|
||
|
Baz,
|
||
|
Quux(String),
|
||
|
}
|
||
|
|
||
|
/// Some docs
|
||
|
#[repr(C)]
|
||
|
pub enum ExhaustiveWithAttrs {
|
||
|
Foo,
|
||
|
Bar,
|
||
|
Baz,
|
||
|
Quux(String),
|
||
|
}
|
||
|
|
||
|
// 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),
|
||
|
}
|
||
|
|
||
|
// no warning, private
|
||
|
#[non_exhaustive]
|
||
|
enum NonExhaustivePrivate {
|
||
|
Foo,
|
||
|
Bar,
|
||
|
Baz,
|
||
|
Quux(String),
|
||
|
}
|
||
|
}
|
||
|
|
||
|
pub mod structs {
|
||
|
pub struct Exhaustive {
|
||
|
foo: u8,
|
||
|
bar: String,
|
||
|
}
|
||
|
|
||
|
// no warning, already non_exhaustive
|
||
|
#[non_exhaustive]
|
||
|
pub struct NonExhaustive {
|
||
|
foo: u8,
|
||
|
bar: String,
|
||
|
}
|
||
|
|
||
|
// no warning, private
|
||
|
struct ExhaustivePrivate {
|
||
|
foo: u8,
|
||
|
bar: String,
|
||
|
}
|
||
|
|
||
|
// no warning, private
|
||
|
#[non_exhaustive]
|
||
|
struct NonExhaustivePrivate {
|
||
|
foo: u8,
|
||
|
bar: String,
|
||
|
}
|
||
|
}
|