RS.CLIPPY.MAIN_RECURSION

Recursion using the entrypoint

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

What it does

Checks for recursion using the entrypoint.

Why is this bad?

Apart from special setups (which we could detect following attributes like #![no_std]), recursing into main() seems like an unintuitive anti-pattern we should be able to detect.

Example

fn main() {
    main();
}