tracing_instrument_mock/
lib.rs

1// SPDX-FileCopyrightText: 2025 Famedly GmbH (info@famedly.com)
2//
3// SPDX-License-Identifier: Apache-2.0
4
5//! Workaround for <https://github.com/tokio-rs/tracing/issues/2082>
6
7use proc_macro::TokenStream;
8
9/// A dummy implementation of the [`tracing::instrument`] proc macro
10/// This should be used as a replacement for the [`tracing::instrument`] proc
11/// macro when the code coverage is needed.
12///
13/// # Example
14/// ```ignore
15/// #[cfg(not(coverage))]
16/// pub use tracing::instrument;
17/// #[cfg(coverage)]
18/// pub use tracing_instrument_mock::instrument;
19///
20/// #[instrument]
21/// fn my_function() {
22/// 	println!("Hello, world!");
23/// }
24/// ```
25#[proc_macro_attribute]
26pub fn instrument(_args: TokenStream, item: TokenStream) -> TokenStream {
27	item
28}