diff --git a/tokio-current-thread/src/lib.rs b/tokio-current-thread/src/lib.rs index 6a9117d53..948327387 100644 --- a/tokio-current-thread/src/lib.rs +++ b/tokio-current-thread/src/lib.rs @@ -194,17 +194,21 @@ struct CurrentRunner { id: Cell>, } -/// Current thread's task runner. This is set in `TaskRunner::with` -thread_local!(static CURRENT: CurrentRunner = CurrentRunner { - spawn: Cell::new(None), - id: Cell::new(None), -}); +thread_local!{ + /// Current thread's task runner. This is set in `TaskRunner::with` + static CURRENT: CurrentRunner = CurrentRunner { + spawn: Cell::new(None), + id: Cell::new(None), + } +} -/// Unique ID to assign to each new executor launched on this thread. -/// -/// The unique ID is used to determine if the currently running executor matches the one referred -/// to by a `Handle` so that direct task dispatch can be used. -thread_local!(static EXECUTOR_ID: Cell = Cell::new(0)); +thread_local!{ + /// Unique ID to assign to each new executor launched on this thread. + /// + /// The unique ID is used to determine if the currently running executor matches the one + /// referred to by a `Handle` so that direct task dispatch can be used. + static EXECUTOR_ID: Cell = Cell::new(0) +} /// Run the executor bootstrapping the execution with the provided future. /// diff --git a/tokio-executor/src/global.rs b/tokio-executor/src/global.rs index 1420deaf2..40bdbf303 100644 --- a/tokio-executor/src/global.rs +++ b/tokio-executor/src/global.rs @@ -64,8 +64,10 @@ enum State { Active } -/// Thread-local tracking the current executor -thread_local!(static EXECUTOR: Cell = Cell::new(State::Empty)); +thread_local!{ + /// Thread-local tracking the current executor + static EXECUTOR: Cell = Cell::new(State::Empty) +} // ===== impl DefaultExecutor ===== diff --git a/tokio-reactor/src/lib.rs b/tokio-reactor/src/lib.rs index 0ded6ea1d..b574fcf55 100644 --- a/tokio-reactor/src/lib.rs +++ b/tokio-reactor/src/lib.rs @@ -167,8 +167,10 @@ pub(crate) enum Direction { /// The global fallback reactor. static HANDLE_FALLBACK: AtomicUsize = AtomicUsize::new(0); -/// Tracks the reactor for the current execution context. -thread_local!(static CURRENT_REACTOR: RefCell> = RefCell::new(None)); +thread_local!{ + /// Tracks the reactor for the current execution context. + static CURRENT_REACTOR: RefCell> = RefCell::new(None) +} const TOKEN_SHIFT: usize = 22; diff --git a/tokio-timer/src/clock/clock.rs b/tokio-timer/src/clock/clock.rs index 00179d3da..1e3b5bfe1 100644 --- a/tokio-timer/src/clock/clock.rs +++ b/tokio-timer/src/clock/clock.rs @@ -20,8 +20,10 @@ pub struct Clock { now: Option>, } -/// Thread-local tracking the current clock -thread_local!(static CLOCK: Cell> = Cell::new(None)); +thread_local!{ + /// Thread-local tracking the current clock + static CLOCK: Cell> = Cell::new(None) +} /// Returns an `Instant` corresponding to "now". /// diff --git a/tokio-timer/src/timer/handle.rs b/tokio-timer/src/timer/handle.rs index 323e39e10..641437293 100644 --- a/tokio-timer/src/timer/handle.rs +++ b/tokio-timer/src/timer/handle.rs @@ -44,8 +44,10 @@ pub(crate) struct HandlePriv { inner: Weak, } -/// Tracks the timer for the current execution context. -thread_local!(static CURRENT_TIMER: RefCell> = RefCell::new(None)); +thread_local!{ + /// Tracks the timer for the current execution context. + static CURRENT_TIMER: RefCell> = RefCell::new(None) +} /// Set the default timer for the duration of the closure. ///