rustc_lint::precedence

Static AMBIGUOUS_NEGATIVE_LITERALS

source
pub static AMBIGUOUS_NEGATIVE_LITERALS: &Lint
Expand description

The ambiguous_negative_literals lint checks for cases that are confusing between a negative literal and a negation that’s not part of the literal.

§Example

-1i32.abs(); // equals -1, while `(-1i32).abs()` equals 1

{{produces}}

§Explanation

Method calls take precedence over unary precedence. Setting the precedence explicitly makes the code clearer and avoid potential bugs.