approx
approx copied to clipboard
`impl RelativeEq for Option<T: RelativeEq>`?
I'd like to be able to write the following code:
pub fn maybe_f32(foo: f32) -> Option<f32> {
// ...
}
/// in test
let c = maybe_f32();
assert_relative_eq!(maybe_f32(123.0), None);
I could do:
assert!(maybe_f32().is_none());
However, the advantage with the first version, is that on failure I can also see the actual value that was returned from maybe_f32
, speeding up debugging a little bit.