Skip to content

Commit a814537

Browse files
committed
Drop uplifted clippy:cmp_nan
1 parent 3e91349 commit a814537

13 files changed

+70
-301
lines changed

src/tools/clippy/clippy_lints/src/declared_lints.rs

-1
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,6 @@ pub(crate) static LINTS: &[&crate::LintInfo] = &[
476476
crate::operators::ARITHMETIC_SIDE_EFFECTS_INFO,
477477
crate::operators::ASSIGN_OP_PATTERN_INFO,
478478
crate::operators::BAD_BIT_MASK_INFO,
479-
crate::operators::CMP_NAN_INFO,
480479
crate::operators::CMP_OWNED_INFO,
481480
crate::operators::DOUBLE_COMPARISONS_INFO,
482481
crate::operators::DURATION_SUBSEC_INFO,

src/tools/clippy/clippy_lints/src/operators/cmp_nan.rs

-30
This file was deleted.

src/tools/clippy/clippy_lints/src/operators/mod.rs

-28
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
mod absurd_extreme_comparisons;
22
mod assign_op_pattern;
33
mod bit_mask;
4-
mod cmp_nan;
54
mod cmp_owned;
65
mod double_comparison;
76
mod duration_subsec;
@@ -485,31 +484,6 @@ declare_clippy_lint! {
485484
"integer division may cause loss of precision"
486485
}
487486

488-
declare_clippy_lint! {
489-
/// ### What it does
490-
/// Checks for comparisons to NaN.
491-
///
492-
/// ### Why is this bad?
493-
/// NaN does not compare meaningfully to anything – not
494-
/// even itself – so those comparisons are simply wrong.
495-
///
496-
/// ### Example
497-
/// ```rust
498-
/// # let x = 1.0;
499-
/// if x == f32::NAN { }
500-
/// ```
501-
///
502-
/// Use instead:
503-
/// ```rust
504-
/// # let x = 1.0f32;
505-
/// if x.is_nan() { }
506-
/// ```
507-
#[clippy::version = "pre 1.29.0"]
508-
pub CMP_NAN,
509-
correctness,
510-
"comparisons to `NAN`, which will always return false, probably not intended"
511-
}
512-
513487
declare_clippy_lint! {
514488
/// ### What it does
515489
/// Checks for conversions to owned values just for the sake
@@ -775,7 +749,6 @@ impl_lint_pass!(Operators => [
775749
FLOAT_EQUALITY_WITHOUT_ABS,
776750
IDENTITY_OP,
777751
INTEGER_DIVISION,
778-
CMP_NAN,
779752
CMP_OWNED,
780753
FLOAT_CMP,
781754
FLOAT_CMP_CONST,
@@ -816,7 +789,6 @@ impl<'tcx> LateLintPass<'tcx> for Operators {
816789
duration_subsec::check(cx, e, op.node, lhs, rhs);
817790
float_equality_without_abs::check(cx, e, op.node, lhs, rhs);
818791
integer_division::check(cx, e, op.node, lhs, rhs);
819-
cmp_nan::check(cx, e, op.node, lhs, rhs);
820792
cmp_owned::check(cx, op.node, lhs, rhs);
821793
float_cmp::check(cx, e, op.node, lhs, rhs);
822794
modulo_one::check(cx, e, op.node, rhs);

src/tools/clippy/clippy_lints/src/renamed_lints.rs

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ pub static RENAMED_LINTS: &[(&str, &str)] = &[
3333
("clippy::zero_width_space", "clippy::invisible_characters"),
3434
("clippy::cast_ref_to_mut", "cast_ref_to_mut"),
3535
("clippy::clone_double_ref", "suspicious_double_ref_op"),
36+
("clippy::cmp_nan", "invalid_nan_comparisons"),
3637
("clippy::drop_bounds", "drop_bounds"),
3738
("clippy::drop_copy", "dropping_copy_types"),
3839
("clippy::drop_ref", "dropping_references"),

src/tools/clippy/tests/ui/cmp_nan.rs

-34
This file was deleted.

src/tools/clippy/tests/ui/cmp_nan.stderr

-148
This file was deleted.

src/tools/clippy/tests/ui/crashes/mut_mut_macro.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![deny(clippy::mut_mut, clippy::zero_ptr, clippy::cmp_nan)]
1+
#![deny(clippy::mut_mut, clippy::zero_ptr)]
22
#![allow(dead_code)]
33

44
// FIXME: compiletest + extern crates doesn't work together. To make this test work, it would need
@@ -8,13 +8,12 @@
88
// extern crate lazy_static;
99
// use std::collections::HashMap;
1010

11-
/// ensure that we don't suggest `is_nan` and `is_null` inside constants
11+
/// ensure that we don't suggest `is_null` inside constants
1212
/// FIXME: once const fn is stable, suggest these functions again in constants
1313
1414
const BAA: *const i32 = 0 as *const i32;
1515
static mut BAR: *const i32 = BAA;
1616
static mut FOO: *const i32 = 0 as *const i32;
17-
static mut BUH: bool = 42.0 < f32::NAN;
1817

1918
#[allow(unused_variables, unused_mut)]
2019
fn main() {

src/tools/clippy/tests/ui/rename.fixed

+2
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
#![allow(invalid_atomic_ordering)]
4242
#![allow(invalid_value)]
4343
#![allow(invalid_from_utf8_unchecked)]
44+
#![allow(invalid_nan_comparisons)]
4445
#![allow(let_underscore_drop)]
4546
#![allow(enum_intrinsics_non_enums)]
4647
#![allow(non_fmt_panics)]
@@ -55,6 +56,7 @@
5556
#![warn(clippy::blocks_in_if_conditions)]
5657
#![warn(clippy::blocks_in_if_conditions)]
5758
#![warn(clippy::box_collection)]
59+
#![warn(invalid_nan_comparisons)]
5860
#![warn(clippy::redundant_static_lifetimes)]
5961
#![warn(clippy::cognitive_complexity)]
6062
#![warn(clippy::derived_hash_with_manual_eq)]

src/tools/clippy/tests/ui/rename.rs

+2
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
#![allow(invalid_atomic_ordering)]
4242
#![allow(invalid_value)]
4343
#![allow(invalid_from_utf8_unchecked)]
44+
#![allow(invalid_nan_comparisons)]
4445
#![allow(let_underscore_drop)]
4546
#![allow(enum_intrinsics_non_enums)]
4647
#![allow(non_fmt_panics)]
@@ -55,6 +56,7 @@
5556
#![warn(clippy::block_in_if_condition_expr)]
5657
#![warn(clippy::block_in_if_condition_stmt)]
5758
#![warn(clippy::box_vec)]
59+
#![warn(clippy::cmp_nan)]
5860
#![warn(clippy::const_static_lifetime)]
5961
#![warn(clippy::cyclomatic_complexity)]
6062
#![warn(clippy::derive_hash_xor_eq)]

0 commit comments

Comments
 (0)