RS.CLIPPY.REDUNDANT_CLOSURE_CALL

Throwaway closures called in the expression they are defined

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

What it does

Detects closures called in the same expression where they are defined.

Why is this bad?

It is unnecessarily adding to the expression's complexity.

Example

let a = (|| 42)();

Use instead:

let a = 42;