Skip to content

Commit 9b4f0e3

Browse files
committed
fix cfg feature macro
1 parent 2e71bdb commit 9b4f0e3

File tree

2 files changed

+9
-23
lines changed

2 files changed

+9
-23
lines changed

tracing-subscriber/src/lib.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -116,20 +116,20 @@ pub use filter::EnvFilter;
116116

117117
pub use layer::Layer;
118118

119-
cfg_fmt! {
119+
cfg_feature!("fmt", {
120120
pub mod fmt;
121-
pub use fmt::Subscriber as FmtSubscriber;
122121
pub use fmt::fmt;
123-
}
122+
pub use fmt::Subscriber as FmtSubscriber;
123+
});
124124

125-
cfg_registry! {
125+
cfg_feature!("registry", {
126126
pub use registry::Registry;
127127

128128
///
129129
pub fn registry() -> Registry {
130130
Registry::default()
131131
}
132-
}
132+
});
133133

134134
use std::default::Default;
135135
/// Tracks the currently executing span on a per-thread basis.

tracing-subscriber/src/macros.rs

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,25 +13,11 @@ macro_rules! try_lock {
1313
};
1414
}
1515

16-
/// Declares fmt items.
17-
#[doc(hidden)]
18-
macro_rules! cfg_fmt {
19-
($($item:item)*) => {
16+
macro_rules! cfg_feature {
17+
($name:expr, { $($item:item)* }) => {
2018
$(
21-
#[cfg(feature = "fmt")]
22-
#[cfg_attr(docsrs, doc(cfg(feature = "fmt")))]
23-
$item
24-
)*
25-
}
26-
}
27-
28-
/// Declares registry items.
29-
#[doc(hidden)]
30-
macro_rules! cfg_registry {
31-
($($item:item)*) => {
32-
$(
33-
#[cfg(feature = "registry")]
34-
#[cfg_attr(docsrs, doc(cfg(feature = "registry")))]
19+
#[cfg(feature = $name)]
20+
#[cfg_attr(docsrs, doc(cfg(feature = $name)))]
3521
$item
3622
)*
3723
}

0 commit comments

Comments
 (0)