Static rustc_lint::types::INVALID_NAN_COMPARISONS

source ·
static INVALID_NAN_COMPARISONS: &Lint
Expand description

The invalid_nan_comparisons lint checks comparison with f32::NAN or f64::NAN as one of the operand.

§Example

let a = 2.3f32;
if a == f32::NAN {}

{{produces}}

§Explanation

NaN does not compare meaningfully to anything – not even itself – so those comparisons are always false.