Skip to content

Commit

Permalink
subscriber: fix LocalTime being re-exported by the time feature (#…
Browse files Browse the repository at this point in the history
…1685)

## Motivation

Currently, the `pub use` re-export for the `LocalTime` struct is enabled
whenever the "time" feature flag is enabled. However, this type only
_exists_ when the "local-time" feature flag is enabled, so enabling only
the `time` feature results in a compilation error.

## Solution

This commit adds a separate `pub use` for `LocalTime` that's only
enabled when the "local-time" feature is enabled.

Fixes #1683
  • Loading branch information
hawkw committed Oct 25, 2021
1 parent e65c78b commit fd12ae1
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions tracing-subscriber/src/fmt/time/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,14 @@ use std::time::Instant;
mod datetime;

#[cfg(feature = "time")]
#[cfg_attr(docsrs, doc(cfg(feature = "time")))]
mod time_crate;
#[cfg(feature = "time")]
#[cfg_attr(docsrs, doc(cfg(feature = "time")))]
pub use time_crate::{LocalTime, UtcTime};
pub use time_crate::UtcTime;

#[cfg(feature = "local-time")]
#[cfg_attr(docsrs, doc(cfg(feature = "local-time")))]
pub use time_crate::LocalTime;

/// A type that can measure and format the current time.
///
Expand Down

0 comments on commit fd12ae1

Please sign in to comment.