Skip to content

Commit

Permalink
fix cfg feature macro
Browse files Browse the repository at this point in the history
  • Loading branch information
k-nasa committed Oct 2, 2020
1 parent 2e71bdb commit 9b4f0e3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 23 deletions.
10 changes: 5 additions & 5 deletions tracing-subscriber/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,20 +116,20 @@ pub use filter::EnvFilter;

pub use layer::Layer;

cfg_fmt! {
cfg_feature!("fmt", {
pub mod fmt;
pub use fmt::Subscriber as FmtSubscriber;
pub use fmt::fmt;
}
pub use fmt::Subscriber as FmtSubscriber;
});

cfg_registry! {
cfg_feature!("registry", {
pub use registry::Registry;

///
pub fn registry() -> Registry {
Registry::default()
}
}
});

use std::default::Default;
/// Tracks the currently executing span on a per-thread basis.
Expand Down
22 changes: 4 additions & 18 deletions tracing-subscriber/src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,11 @@ macro_rules! try_lock {
};
}

/// Declares fmt items.
#[doc(hidden)]
macro_rules! cfg_fmt {
($($item:item)*) => {
macro_rules! cfg_feature {
($name:expr, { $($item:item)* }) => {
$(
#[cfg(feature = "fmt")]
#[cfg_attr(docsrs, doc(cfg(feature = "fmt")))]
$item
)*
}
}

/// Declares registry items.
#[doc(hidden)]
macro_rules! cfg_registry {
($($item:item)*) => {
$(
#[cfg(feature = "registry")]
#[cfg_attr(docsrs, doc(cfg(feature = "registry")))]
#[cfg(feature = $name)]
#[cfg_attr(docsrs, doc(cfg(feature = $name)))]
$item
)*
}
Expand Down

0 comments on commit 9b4f0e3

Please sign in to comment.