Skip to content

Commit

Permalink
Drop uplifted clippy:cmp_nan
Browse files Browse the repository at this point in the history
  • Loading branch information
Urgau committed Jun 10, 2023
1 parent 3e91349 commit a814537
Show file tree
Hide file tree
Showing 13 changed files with 70 additions and 301 deletions.
1 change: 0 additions & 1 deletion src/tools/clippy/clippy_lints/src/declared_lints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,6 @@ pub(crate) static LINTS: &[&crate::LintInfo] = &[
crate::operators::ARITHMETIC_SIDE_EFFECTS_INFO,
crate::operators::ASSIGN_OP_PATTERN_INFO,
crate::operators::BAD_BIT_MASK_INFO,
crate::operators::CMP_NAN_INFO,
crate::operators::CMP_OWNED_INFO,
crate::operators::DOUBLE_COMPARISONS_INFO,
crate::operators::DURATION_SUBSEC_INFO,
Expand Down
30 changes: 0 additions & 30 deletions src/tools/clippy/clippy_lints/src/operators/cmp_nan.rs

This file was deleted.

28 changes: 0 additions & 28 deletions src/tools/clippy/clippy_lints/src/operators/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
mod absurd_extreme_comparisons;
mod assign_op_pattern;
mod bit_mask;
mod cmp_nan;
mod cmp_owned;
mod double_comparison;
mod duration_subsec;
Expand Down Expand Up @@ -485,31 +484,6 @@ declare_clippy_lint! {
"integer division may cause loss of precision"
}

declare_clippy_lint! {
/// ### What it does
/// Checks for comparisons to NaN.
///
/// ### Why is this bad?
/// NaN does not compare meaningfully to anything – not
/// even itself – so those comparisons are simply wrong.
///
/// ### Example
/// ```rust
/// # let x = 1.0;
/// if x == f32::NAN { }
/// ```
///
/// Use instead:
/// ```rust
/// # let x = 1.0f32;
/// if x.is_nan() { }
/// ```
#[clippy::version = "pre 1.29.0"]
pub CMP_NAN,
correctness,
"comparisons to `NAN`, which will always return false, probably not intended"
}

declare_clippy_lint! {
/// ### What it does
/// Checks for conversions to owned values just for the sake
Expand Down Expand Up @@ -775,7 +749,6 @@ impl_lint_pass!(Operators => [
FLOAT_EQUALITY_WITHOUT_ABS,
IDENTITY_OP,
INTEGER_DIVISION,
CMP_NAN,
CMP_OWNED,
FLOAT_CMP,
FLOAT_CMP_CONST,
Expand Down Expand Up @@ -816,7 +789,6 @@ impl<'tcx> LateLintPass<'tcx> for Operators {
duration_subsec::check(cx, e, op.node, lhs, rhs);
float_equality_without_abs::check(cx, e, op.node, lhs, rhs);
integer_division::check(cx, e, op.node, lhs, rhs);
cmp_nan::check(cx, e, op.node, lhs, rhs);
cmp_owned::check(cx, op.node, lhs, rhs);
float_cmp::check(cx, e, op.node, lhs, rhs);
modulo_one::check(cx, e, op.node, rhs);
Expand Down
1 change: 1 addition & 0 deletions src/tools/clippy/clippy_lints/src/renamed_lints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ pub static RENAMED_LINTS: &[(&str, &str)] = &[
("clippy::zero_width_space", "clippy::invisible_characters"),
("clippy::cast_ref_to_mut", "cast_ref_to_mut"),
("clippy::clone_double_ref", "suspicious_double_ref_op"),
("clippy::cmp_nan", "invalid_nan_comparisons"),
("clippy::drop_bounds", "drop_bounds"),
("clippy::drop_copy", "dropping_copy_types"),
("clippy::drop_ref", "dropping_references"),
Expand Down
34 changes: 0 additions & 34 deletions src/tools/clippy/tests/ui/cmp_nan.rs

This file was deleted.

148 changes: 0 additions & 148 deletions src/tools/clippy/tests/ui/cmp_nan.stderr

This file was deleted.

5 changes: 2 additions & 3 deletions src/tools/clippy/tests/ui/crashes/mut_mut_macro.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![deny(clippy::mut_mut, clippy::zero_ptr, clippy::cmp_nan)]
#![deny(clippy::mut_mut, clippy::zero_ptr)]
#![allow(dead_code)]

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

/// ensure that we don't suggest `is_nan` and `is_null` inside constants
/// ensure that we don't suggest `is_null` inside constants
/// FIXME: once const fn is stable, suggest these functions again in constants

const BAA: *const i32 = 0 as *const i32;
static mut BAR: *const i32 = BAA;
static mut FOO: *const i32 = 0 as *const i32;
static mut BUH: bool = 42.0 < f32::NAN;

#[allow(unused_variables, unused_mut)]
fn main() {
Expand Down
2 changes: 2 additions & 0 deletions src/tools/clippy/tests/ui/rename.fixed
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
#![allow(invalid_atomic_ordering)]
#![allow(invalid_value)]
#![allow(invalid_from_utf8_unchecked)]
#![allow(invalid_nan_comparisons)]
#![allow(let_underscore_drop)]
#![allow(enum_intrinsics_non_enums)]
#![allow(non_fmt_panics)]
Expand All @@ -55,6 +56,7 @@
#![warn(clippy::blocks_in_if_conditions)]
#![warn(clippy::blocks_in_if_conditions)]
#![warn(clippy::box_collection)]
#![warn(invalid_nan_comparisons)]
#![warn(clippy::redundant_static_lifetimes)]
#![warn(clippy::cognitive_complexity)]
#![warn(clippy::derived_hash_with_manual_eq)]
Expand Down
2 changes: 2 additions & 0 deletions src/tools/clippy/tests/ui/rename.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
#![allow(invalid_atomic_ordering)]
#![allow(invalid_value)]
#![allow(invalid_from_utf8_unchecked)]
#![allow(invalid_nan_comparisons)]
#![allow(let_underscore_drop)]
#![allow(enum_intrinsics_non_enums)]
#![allow(non_fmt_panics)]
Expand All @@ -55,6 +56,7 @@
#![warn(clippy::block_in_if_condition_expr)]
#![warn(clippy::block_in_if_condition_stmt)]
#![warn(clippy::box_vec)]
#![warn(clippy::cmp_nan)]
#![warn(clippy::const_static_lifetime)]
#![warn(clippy::cyclomatic_complexity)]
#![warn(clippy::derive_hash_xor_eq)]
Expand Down
Loading

0 comments on commit a814537

Please sign in to comment.