diff --git a/clippy_lints/src/consts.rs b/clippy_lints/src/consts.rs index d4ee76590561..9ed37e70a01d 100644 --- a/clippy_lints/src/consts.rs +++ b/clippy_lints/src/consts.rs @@ -92,8 +92,10 @@ impl PartialEq for Constant { // we want `Fw32 == FwAny` and `FwAny == Fw64`, by transitivity we must have // `Fw32 == Fw64` so don’t compare them match (ls.parse::(), rs.parse::()) { - (Ok(l), Ok(r)) => l.eq(&r) && - (l.is_sign_positive() == r.is_sign_positive()), // needed for 0.0 != -0.0 + // mem::transmute is required to catch non-matching 0.0, -0.0, and NaNs + (Ok(l), Ok(r)) => unsafe { + mem::transmute::(l) == mem::transmute::(r) + }, _ => false, } }