According to the Eq documentation any type implementing the trait should ensure that all values are reflexive.
This is not the case for Bson even though it implements Eq:
fn main() {
let v = bson::Bson::Double(f64::NAN);
assert_eq!(v, v);
}
thread 'main' (2304097) panicked at src/main.rs:3:5:
assertion `left == right` failed
left: Double(NaN)
right: Double(NaN)
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Either the Eq implementation should be removed or Bson::eq should compare the bits of f64's (or something similar).
According to the
Eqdocumentation any type implementing the trait should ensure that all values are reflexive.This is not the case for
Bsoneven though it implementsEq:Either the
Eqimplementation should be removed orBson::eqshould compare the bits off64's (or something similar).