RS.CLIPPY.EMPTY_ENUM_VARIANTS_WITH_BRACKETS

Finds enum variants with empty brackets

This checker is a Clippy lint created by The Rust Project Contributors. The documentation shown here is a copy of the original documentation for: empty_enum_variants_with_brackets. Copyright ©2025 The Rust Team. All rights reserved.

What it does

Finds enum variants without fields that are declared with empty brackets.

Why restrict this?

Empty brackets after a enum variant declaration are redundant and can be omitted, and it may be desirable to do so consistently for style.

However, removing the brackets also introduces a public constant named after the variant, so this is not just a syntactic simplification but an API change, and adding them back is a breaking API change.

Example

enum MyEnum {
    HasData(u8),
    HasNoData(),       // redundant parentheses
    NoneHereEither {}, // redundant braces
}

Use instead:

enum MyEnum {
    HasData(u8),
    HasNoData,
    NoneHereEither,
}