Skip to content

Fix #6817: Trigger float_cmp_const for assert_eq! with const floats#17024

Open
theoxfaber wants to merge 3 commits into
rust-lang:masterfrom
theoxfaber:fix-6817-float-cmp-assert
Open

Fix #6817: Trigger float_cmp_const for assert_eq! with const floats#17024
theoxfaber wants to merge 3 commits into
rust-lang:masterfrom
theoxfaber:fix-6817-float-cmp-assert

Conversation

@theoxfaber
Copy link
Copy Markdown

@theoxfaber theoxfaber commented May 16, 2026

Fixes #6817

This PR modifies float_cmp to detect when a strict comparison of floating-point constants happens inside assertion macros (assert_eq!, assert_ne!, etc.) and correctly emits float_cmp_const instead of the general float_cmp lint. It avoids double-linting by skipping the standard check when the expression is inside an assertion macro.

changelog: Fix [float_cmp_const] not triggering on assert_eq!

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label May 16, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented May 16, 2026

r? @llogiq

rustbot has assigned @llogiq.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: 7 candidates
  • 7 candidates expanded to 7 candidates
  • Random selection from Jarcho, llogiq, samueltardieu

@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented May 16, 2026

⚠️ Warning ⚠️

  • There are issue links (such as #123) in the commit messages of the following commits.
    Please move them to the PR description, to avoid spamming the issues with references to the commit, and so this bot can automatically canonicalize them to avoid issues with subtree.

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

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties

Projects

None yet

Development

Successfully merging this pull request may close these issues.

assert_eq! with a literal float should probably fire float_cmp_const not float_cmp

3 participants