Static DOUBLE_NEGATIONS

Source
pub static DOUBLE_NEGATIONS: &Lint
Expand description

The double_negations lint detects expressions of the form --x.

§Example

fn main() {
    let x = 1;
    let _b = --x;
}

{{produces}}

§Explanation

Negating something twice is usually the same as not negating it at all. However, a double negation in Rust can easily be confused with the prefix decrement operator that exists in many languages derived from C. Use -(-x) if you really wanted to negate the value twice.

To decrement a value, use x -= 1 instead.