mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-23 05:03:21 +00:00
Add test with attrs
This commit is contained in:
parent
e0ae980fab
commit
3e3dff7135
3 changed files with 38 additions and 2 deletions
|
@ -16,6 +16,16 @@ pub mod enums {
|
|||
Quux(String),
|
||||
}
|
||||
|
||||
/// Some docs
|
||||
#[repr(C)]
|
||||
#[non_exhaustive]
|
||||
pub enum ExhaustiveWithAttrs {
|
||||
Foo,
|
||||
Bar,
|
||||
Baz,
|
||||
Quux(String),
|
||||
}
|
||||
|
||||
// no warning, already non_exhaustive
|
||||
#[non_exhaustive]
|
||||
pub enum NonExhaustive {
|
||||
|
|
|
@ -15,6 +15,15 @@ pub mod enums {
|
|||
Quux(String),
|
||||
}
|
||||
|
||||
/// Some docs
|
||||
#[repr(C)]
|
||||
pub enum ExhaustiveWithAttrs {
|
||||
Foo,
|
||||
Bar,
|
||||
Baz,
|
||||
Quux(String),
|
||||
}
|
||||
|
||||
// no warning, already non_exhaustive
|
||||
#[non_exhaustive]
|
||||
pub enum NonExhaustive {
|
||||
|
|
|
@ -20,8 +20,25 @@ LL | #[non_exhaustive]
|
|||
LL | pub enum Exhaustive {
|
||||
|
|
||||
|
||||
error: exported enums should not be exhaustive
|
||||
--> $DIR/exhaustive_items.rs:20:5
|
||||
|
|
||||
LL | / pub enum ExhaustiveWithAttrs {
|
||||
LL | | Foo,
|
||||
LL | | Bar,
|
||||
LL | | Baz,
|
||||
LL | | Quux(String),
|
||||
LL | | }
|
||||
| |_____^
|
||||
|
|
||||
help: try adding #[non_exhaustive]
|
||||
|
|
||||
LL | #[non_exhaustive]
|
||||
LL | pub enum ExhaustiveWithAttrs {
|
||||
|
|
||||
|
||||
error: exported structs should not be exhaustive
|
||||
--> $DIR/exhaustive_items.rs:46:5
|
||||
--> $DIR/exhaustive_items.rs:55:5
|
||||
|
|
||||
LL | / pub struct Exhaustive {
|
||||
LL | | foo: u8,
|
||||
|
@ -40,5 +57,5 @@ LL | #[non_exhaustive]
|
|||
LL | pub struct Exhaustive {
|
||||
|
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
|
|
Loading…
Reference in a new issue