Skip to content

Commit

Permalink
axum: Silence unused_macros warning if trace!() and error!() ma…
Browse files Browse the repository at this point in the history
…cros are not used

This fixes a compiler warning when used with `--no-default-features`
  • Loading branch information
Turbo87 committed Dec 27, 2024
1 parent 59259bf commit 61c4f8e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions axum/src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,25 +68,29 @@ macro_rules! all_the_tuples {
}

#[cfg(feature = "tracing")]
#[allow(unused_macros)]
macro_rules! trace {
($($tt:tt)*) => {
tracing::trace!($($tt)*)
}
}

#[cfg(feature = "tracing")]
#[allow(unused_macros)]
macro_rules! error {
($($tt:tt)*) => {
tracing::error!($($tt)*)
};
}

#[cfg(not(feature = "tracing"))]
#[allow(unused_macros)]
macro_rules! trace {
($($tt:tt)*) => {};
}

#[cfg(not(feature = "tracing"))]
#[allow(unused_macros)]
macro_rules! error {
($($tt:tt)*) => {};
}

0 comments on commit 61c4f8e

Please sign in to comment.