diff --git a/tracing-subscriber/src/layer/mod.rs b/tracing-subscriber/src/layer/mod.rs index cebbb3d9c2..2a647623f8 100644 --- a/tracing-subscriber/src/layer/mod.rs +++ b/tracing-subscriber/src/layer/mod.rs @@ -1175,6 +1175,11 @@ where macro_rules! layer_impl_body { () => { + #[inline] + fn on_layer(&mut self, subscriber: &mut S) { + self.deref_mut().on_layer(subscriber); + } + #[inline] fn new_span(&self, attrs: &span::Attributes<'_>, id: &span::Id, ctx: Context<'_, S>) { self.deref().new_span(attrs, id, ctx) @@ -1238,48 +1243,11 @@ macro_rules! layer_impl_body { }; } -impl Layer for Arc -where - L: Layer, - S: Subscriber, -{ - fn on_layer(&mut self, subscriber: &mut S) { - if let Some(inner) = Arc::get_mut(self) { - // XXX(eliza): this may behave weird if another `Arc` clone of this - // layer is layered onto a _different_ subscriber...but there's no - // good solution for that... - inner.on_layer(subscriber); - } - } - - layer_impl_body! {} -} - -impl Layer for Arc + Send + Sync> -where - S: Subscriber, -{ - fn on_layer(&mut self, subscriber: &mut S) { - if let Some(inner) = Arc::get_mut(self) { - // XXX(eliza): this may behave weird if another `Arc` clone of this - // layer is layered onto a _different_ subscriber...but there's no - // good solution for that... - inner.on_layer(subscriber); - } - } - - layer_impl_body! {} -} - impl Layer for Box where L: Layer, S: Subscriber, { - fn on_layer(&mut self, subscriber: &mut S) { - self.deref_mut().on_layer(subscriber); - } - layer_impl_body! {} } @@ -1287,10 +1255,6 @@ impl Layer for Box + Send + Sync> where S: Subscriber, { - fn on_layer(&mut self, subscriber: &mut S) { - self.deref_mut().on_layer(subscriber); - } - layer_impl_body! {} }