RS.CLIPPY.SHADOW_REUSE
Rebinding a name to an expression that reuses the original value, e.g., `let x = x + 1`
This checker is a Clippy lint created by The Rust Project Contributors. The documentation shown here is a copy of the original documentation for: shadow_reuse. Copyright ©2025 The Rust Team. All rights reserved.
What it does
Checks for bindings that shadow other bindings already in scope, while reusing the original value.
Why restrict this?
Some argue that name shadowing like this hurts readability, because a value may be bound to different things depending on position in the code.
See also shadow_same and shadow_unrelated for other restrictions on shadowing.
Example
let x = 2;
let x = x + 1;
use different variable name:
let x = 2;
let y = x + 1;