mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-12-11 22:02:55 +00:00
1ee9993a96
- Add a new early pass lint. - Add relevant UI tests.
27 lines
933 B
Rust
27 lines
933 B
Rust
#![warn(clippy::empty_enum_variants_with_brackets)]
|
|
#![allow(dead_code)]
|
|
|
|
pub enum PublicTestEnum {
|
|
NonEmptyBraces { x: i32, y: i32 }, // No error
|
|
NonEmptyParentheses(i32, i32), // No error
|
|
EmptyBraces {}, //~ ERROR: enum variant has empty brackets
|
|
EmptyParentheses(), //~ ERROR: enum variant has empty brackets
|
|
}
|
|
|
|
enum TestEnum {
|
|
NonEmptyBraces { x: i32, y: i32 }, // No error
|
|
NonEmptyParentheses(i32, i32), // No error
|
|
EmptyBraces {}, //~ ERROR: enum variant has empty brackets
|
|
EmptyParentheses(), //~ ERROR: enum variant has empty brackets
|
|
AnotherEnum, // No error
|
|
}
|
|
|
|
enum TestEnumWithFeatures {
|
|
NonEmptyBraces {
|
|
#[cfg(feature = "thisisneverenabled")]
|
|
x: i32,
|
|
}, // No error
|
|
NonEmptyParentheses(#[cfg(feature = "thisisneverenabled")] i32), // No error
|
|
}
|
|
|
|
fn main() {}
|