diff --git a/tracing-subscriber/src/fmt/format/mod.rs b/tracing-subscriber/src/fmt/format/mod.rs index b68639b2b2..1d1dc27ac7 100644 --- a/tracing-subscriber/src/fmt/format/mod.rs +++ b/tracing-subscriber/src/fmt/format/mod.rs @@ -576,7 +576,10 @@ where let fields = &ext .get::>() .expect("Unable to find FormattedFields in extensions; this is a bug"); - write!(f, "{}{}{}:", bold.paint("{"), fields, bold.paint("}")) + if !fields.is_empty() { + write!(f, "{}{}{}", bold.paint("{"), fields, bold.paint("}"))?; + } + f.pad(":") })?; if seen {