RS.CLIPPY.EMPTY_STRUCTS_WITH_BRACKETS

Finds struct declarations 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_structs_with_brackets. Copyright ©2025 The Rust Team. All rights reserved.

What it does

Finds structs without fields (a so-called "empty struct") that are declared with brackets.

Why restrict this?

Empty brackets after a struct declaration 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 struct, so this is not just a syntactic simplification but an API change, and adding them back is a breaking API change.

Example

struct Cookie {}
struct Biscuit();

Use instead:

struct Cookie;
struct Biscuit;