RS.CLIPPY.UNUSED_UNIT
Needless unit expression
This checker is a Clippy lint created by The Rust Project Contributors. The documentation shown here is a copy of the original documentation for: unused_unit. Copyright ©2025 The Rust Team. All rights reserved.
What it does
Checks for unit (()) expressions that can be removed.
Why is this bad?
Such expressions add no value, but can make the code
less readable. Depending on formatting they can make a break or return
statement look like a function call.
Example
fn return_unit() -> () {
()
}
is equivalent to
fn return_unit() {}