diff --git a/tracing-subscriber/src/subscribe/mod.rs b/tracing-subscriber/src/subscribe/mod.rs index 475d138b76..d56401aec6 100644 --- a/tracing-subscriber/src/subscribe/mod.rs +++ b/tracing-subscriber/src/subscribe/mod.rs @@ -417,7 +417,11 @@ //! [`LevelFilter`]: crate::filter::LevelFilter //! [feat]: crate#feature-flags use crate::filter; -use std::{any::TypeId, ops::Deref, ptr::NonNull, sync::Arc}; +use std::{ + any::TypeId, + ops::{Deref, DerefMut}, + ptr::NonNull, +}; use tracing_core::{ collect::{Collect, Interest}, metadata::Metadata, @@ -1083,6 +1087,11 @@ where macro_rules! layer_impl_body { () => { + #[inline] + fn on_subscribe(&mut self, collect: &mut C) { + self.deref_mut().on_subscribe(collect); + } + #[inline] fn on_new_span(&self, attrs: &span::Attributes<'_>, id: &span::Id, ctx: Context<'_, C>) { self.deref().on_new_span(attrs, id, ctx) @@ -1146,21 +1155,6 @@ macro_rules! layer_impl_body { }; } -impl Subscribe for Arc -where - S: Subscribe, - C: Collect, -{ - layer_impl_body! {} -} - -impl Subscribe for Arc> -where - C: Collect, -{ - layer_impl_body! {} -} - impl Subscribe for Box where S: Subscribe,