diff --git a/tracing-core/src/field.rs b/tracing-core/src/field.rs index f9e70aabea..42209f17a1 100644 --- a/tracing-core/src/field.rs +++ b/tracing-core/src/field.rs @@ -519,7 +519,7 @@ impl fmt::Display for DisplayValue { impl crate::sealed::Sealed for DebugValue {} -impl Value for DebugValue +impl Value for DebugValue where T: fmt::Debug, { @@ -540,6 +540,16 @@ impl Value for Empty { fn record(&self, _: &Field, _: &mut dyn Visit) {} } +impl crate::sealed::Sealed for Option {} + +impl Value for Option { + fn record(&self, key: &Field, visitor: &mut dyn Visit) { + if let Some(v) = &self { + v.record(key, visitor) + } + } +} + // ===== impl Field ===== impl Field {