RS.CLIPPY.UNNEEDED_STRUCT_PATTERN
Using struct pattern to match against unit variant
This checker is a Clippy lint created by The Rust Project Contributors. The documentation shown here is a copy of the original documentation for: unneeded_struct_pattern. Copyright ©2025 The Rust Team. All rights reserved.
What it does
Checks for struct patterns that match against unit variant.
Why is this bad?
Struct pattern { } or { .. } is not needed for unit variant.
Example
match Some(42) {
Some(v) => v,
None { .. } => 0,
};
// Or
match Some(42) {
Some(v) => v,
None { } => 0,
};
Use instead:
match Some(42) {
Some(v) => v,
None => 0,
};