Skip to content

Allow float comparison with zero #3804

Open
@konstin

Description

@konstin

cargo clippy -V: clippy 0.0.212 (d61b254 2019-02-19)

Clippy should allow float comparison with zero. The current behavior seems to be a regression as this has apparently already been reported and fixed in #165/#1142.

error: strict comparison of f32 or f64
   --> tests/test_datetime.rs:125:5
    |
125 |     assert_eq!(offset, 0f32);
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: #[deny(clippy::float_cmp)] on by default
note: std::f32::EPSILON and std::f64::EPSILON are available.
   --> tests/test_datetime.rs:125:5
    |
125 |     assert_eq!(offset, 0f32);
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#float_cmp
    = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: Clippy is not doing the correct thing

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions