rust-lang/rust-clippy

Expand float_cmp to structs with PartialEq

Open

#1,685 opened on Apr 17, 2017

View on GitHub
 (5 comments) (0 reactions) (0 assignees)Rust (1,391 forks)batch import
C-enhancementL-correctnessT-middlegood first issue

Repository metrics

Stars
 (10,406 stars)
PR merge metrics
 (Avg merge 19d 22h) (113 merged PRs in 30d)

Description

Example:

#[derive(PartialEq)]
struct Data {
    v: f64,
}

fn main() {
    let d1 = Data { v: 1.0 };
    let d2 = Data { v: 2.0 };

    // here should be a warning
    println!("{}", d1 == d2);
}

Contributor guide