rust-lang/rust-clippy

Expand float_cmp to structs with PartialEq

Open

#1685 opened on Apr 17, 2017

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

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