From 27a2ce9f9a969b1a93d1cc594aa21031a8281cda Mon Sep 17 00:00:00 2001 From: Eliza Weisman Date: Sun, 19 Sep 2021 11:19:48 -0700 Subject: [PATCH] subscriber: use `f64` consts as module imports This fixes the build on Rust 1.42.0, where primitive types don't have associated consts. My bad! --- tracing-subscriber/src/filter/env/field.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tracing-subscriber/src/filter/env/field.rs b/tracing-subscriber/src/filter/env/field.rs index ea6c197bd4..0046b2cee7 100644 --- a/tracing-subscriber/src/filter/env/field.rs +++ b/tracing-subscriber/src/filter/env/field.rs @@ -219,7 +219,7 @@ impl fmt::Display for ValueMatch { match self { ValueMatch::Bool(ref inner) => fmt::Display::fmt(inner, f), ValueMatch::F64(ref inner) => fmt::Display::fmt(inner, f), - ValueMatch::NaN => fmt::Display::fmt(&f64::NAN, f), + ValueMatch::NaN => fmt::Display::fmt(&std::f64::NAN, f), ValueMatch::I64(ref inner) => fmt::Display::fmt(inner, f), ValueMatch::U64(ref inner) => fmt::Display::fmt(inner, f), ValueMatch::Pat(ref inner) => fmt::Display::fmt(inner, f), @@ -355,7 +355,9 @@ impl<'a> Visit for MatchVisitor<'a> { Some((ValueMatch::NaN, ref matched)) if value.is_nan() => { matched.store(true, Release); } - Some((ValueMatch::F64(ref e), ref matched)) if (value - *e).abs() < f64::EPSILON => { + Some((ValueMatch::F64(ref e), ref matched)) + if (value - *e).abs() < std::f64::EPSILON => + { matched.store(true, Release); } _ => {}