RS.CLIPPY.NEEDLESS_ELSE

Empty else branch

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

What it does

Checks for empty else branches.

Why is this bad?

An empty else branch does nothing and can be removed.

Example

if check() {
    println!("Check successful!");
} else {
}

Use instead:

if check() {
    println!("Check successful!");
}