UNUSED_ASSIGNMENTS in rustc_lint_defs::builtin - Rust
Description: The `unused_assignments` lint detects assignments that will never be read.

Skip to main content

## UNUSED_ASSIGNMENTS

# Static UNUSED_ASSIGNMENTS

Source

    pub static UNUSED_ASSIGNMENTS: &Lint

Expand description

The `unused_assignments` lint detects assignments that will never be read.

#### §Example

    let mut x = 5;
    x = 6;

{{produces}}

#### §Explanation

Unused assignments may signal a mistake or unfinished code. If the variable is never used after being assigned, then the assignment can be removed. Variables with an underscore prefix such as `_x` will not trigger this lint.