diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index d41b47c9..1ca6969d 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -270,6 +270,26 @@ jobs: command: test args: --all + test-unstable: + # Test the `tracing-unstable` cfg flags + env: + RUSTFLAGS: "--cfg tracing_unstable" + needs: check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@main + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + profile: minimal + override: true + - name: Run tests + uses: actions-rs/cargo@v1 + with: + command: test + args: --all --features "valuable" + + features-stable: # Feature flag tests that run on stable Rust. # TODO(david): once tracing's MSRV goes up to Rust 1.51, we should be able to switch to diff --git a/examples/examples/valuable_instrument.rs b/examples/examples/valuable_instrument.rs index a8f93b5a..729ebc67 100644 --- a/examples/examples/valuable_instrument.rs +++ b/examples/examples/valuable_instrument.rs @@ -2,7 +2,7 @@ mod app { use std::collections::HashMap; use tracing::field::valuable; - use tracing::{info, info_span, instrument}; + use tracing::{info, instrument}; use valuable::Valuable; #[derive(Valuable)] diff --git a/tracing-core/src/field.rs b/tracing-core/src/field.rs index 1a11f6bc..e5c4cc75 100644 --- a/tracing-core/src/field.rs +++ b/tracing-core/src/field.rs @@ -643,7 +643,7 @@ impl crate::sealed::Sealed for valuable::Value<'_> {} #[cfg_attr(docsrs, doc(cfg(all(tracing_unstable, feature = "valuable"))))] impl Value for valuable::Value<'_> { fn record(&self, key: &Field, visitor: &mut dyn Visit) { - visitor.record_value(key, self) + visitor.record_value(key, *self) } } @@ -654,7 +654,7 @@ impl crate::sealed::Sealed for &'_ dyn valuable::Valuable {} #[cfg_attr(docsrs, doc(cfg(all(tracing_unstable, feature = "valuable"))))] impl Value for &'_ dyn valuable::Valuable { fn record(&self, key: &Field, visitor: &mut dyn Visit) { - visitor.record_value(key, &self.as_value()) + visitor.record_value(key, self.as_value()) } }