RS.CLIPPY.SEMICOLON_IF_NOTHING_RETURNED

Add a semicolon if nothing is returned

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

What it does

Looks for blocks of expressions and fires if the last expression returns () but is not followed by a semicolon.

Why is this bad?

The semicolon might be optional but when extending the block with new code, it doesn't require a change in previous last line.

Example

fn main() {
    println!("Hello world")
}

Use instead:

fn main() {
    println!("Hello world");
}