tokio-rs / tracing

Application level tracing for Rust.
https://tracing.rs
MIT License
5.52k stars 725 forks source link

fix: correct SerializeField definition #3040

Closed hds closed 3 months ago

hds commented 3 months ago

Motivation

Clippy in 1.80.0 alerted us to the fact that SerializeField was never constructed (and due to its non-pub member, it can't be constructed outside the tracing-serde crate where it's from).

Solution

This change fixes the definition to hold a reference to a Field, which is what the other Serialize* types do. It also implements AsSerde for this type and uses it inside the SerializeFieldSet type.

As a bonus, Clippy is now also happy that the type is constructed.

The example collector in the tracing-serde crate was also renamed from JsonSubscriber to JsonCollector.