RS.CLIPPY.USED_UNDERSCORE_BINDING

Using a binding which is prefixed with an underscore

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

What it does

Checks for the use of bindings with a single leading underscore.

Why is this bad?

A single leading underscore is usually used to indicate that a binding will not be used. Using such a binding breaks this expectation.

Known problems

The lint does not work properly with desugaring and macro, it has been allowed in the meantime.

Example

let _x = 0;
let y = _x + 1; // Here we are using `_x`, even though it has a leading
                // underscore. We should rename `_x` to `x`