Skip to content

Uplift clippy::cmp_nan lint#111818

Merged
bors merged 3 commits intorust-lang:masterfrom
Urgau:uplift_cmp_nan
Jun 10, 2023
Merged

Uplift clippy::cmp_nan lint#111818
bors merged 3 commits intorust-lang:masterfrom
Urgau:uplift_cmp_nan

Conversation

@Urgau
Copy link
Member

@Urgau Urgau commented May 21, 2023

This PR aims at uplifting the clippy::cmp_nan lint into rustc.

invalid_nan_comparisons

(deny-by-default) (warn-by-default)

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 {}

Explanation

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


Mostly followed the instructions for uplifting a clippy lint described here: #99696 (review)

@rustbot label: +I-lang-nominated
r? compiler

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. finished-final-comment-period The final comment period is finished for this PR / Issue. merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-lang Relevant to the language team

Projects

None yet

Development

Successfully merging this pull request may close these issues.