diff --git a/tracing-core/src/lib.rs b/tracing-core/src/lib.rs index 8cd00fd4e5..393f801edc 100644 --- a/tracing-core/src/lib.rs +++ b/tracing-core/src/lib.rs @@ -173,9 +173,7 @@ extern crate alloc; /// /// For example: /// ```rust -/// # #[macro_use] -/// # extern crate tracing_core; -/// use tracing_core::callsite; +/// use tracing_core::{callsite, identify_callsite}; /// # use tracing_core::{Metadata, collect::Interest}; /// # fn main() { /// pub struct MyCallsite { @@ -209,9 +207,8 @@ macro_rules! identify_callsite { /// /// /// For example: /// ```rust -/// # #[macro_use] -/// # extern crate tracing_core; /// # use tracing_core::{callsite::Callsite, collect::Interest}; +/// use tracing_core::metadata; /// use tracing_core::metadata::{Kind, Level, Metadata}; /// # fn main() { /// # pub struct MyCallsite { } diff --git a/tracing/src/macros.rs b/tracing/src/macros.rs index fa8969ddac..ab9225a43a 100644 --- a/tracing/src/macros.rs +++ b/tracing/src/macros.rs @@ -576,9 +576,7 @@ macro_rules! error_span { // /// // /// For example, the following does not compile: // /// ```rust,compile_fail -// /// # #[macro_use] -// /// # extern crate tracing; -// /// # use tracing::Level; +// /// # use tracing::{Level, event}; // /// # fn main() { // /// event!(Level::INFO, foo = 5, bad_field, bar = "hello") // /// #} diff --git a/tracing/src/span.rs b/tracing/src/span.rs index bc8741e025..73113f14f1 100644 --- a/tracing/src/span.rs +++ b/tracing/src/span.rs @@ -62,8 +62,7 @@ //! The `enter` method enters a span, returning a [guard] that exits the span //! when dropped //! ``` -//! # #[macro_use] extern crate tracing; -//! # use tracing::Level; +//! # use tracing::{Level, span}; //! let my_var: u64 = 5; //! let my_span = span!(Level::TRACE, "my_span", my_var); //! @@ -88,8 +87,7 @@ //! `in_scope` takes a closure or function pointer and executes it inside the //! span. //! ``` -//! # #[macro_use] extern crate tracing; -//! # use tracing::Level; +//! # use tracing::{Level, span}; //! let my_var: u64 = 5; //! let my_span = span!(Level::TRACE, "my_span", my_var = &my_var); //! @@ -122,8 +120,7 @@ //! as long as the longest-executing span in its subtree. //! //! ``` -//! # #[macro_use] extern crate tracing; -//! # use tracing::Level; +//! # use tracing::{Level, span}; //! // this span is considered the "root" of a new trace tree: //! span!(Level::INFO, "root").in_scope(|| { //! // since we are now inside "root", this span is considered a child @@ -143,8 +140,7 @@ //! the `span!` macro. For example: //! //! ```rust -//! # #[macro_use] extern crate tracing; -//! # use tracing::Level; +//! # use tracing::{Level, span}; //! // Create, but do not enter, a span called "foo". //! let foo = span!(Level::INFO, "foo"); //! @@ -186,8 +182,6 @@ //! _closed_. Consider, for example, a future which has an associated //! span and enters that span every time it is polled: //! ```rust -//! # extern crate tracing; -//! # extern crate futures; //! # use futures::{Future, Poll, Async}; //! struct MyFuture { //! // data @@ -227,8 +221,7 @@ //! that handle "closes" the span, since the capacity to enter it no longer //! exists. For example: //! ``` -//! # #[macro_use] extern crate tracing; -//! # use tracing::Level; +//! # use tracing::{Level, span}; //! { //! span!(Level::TRACE, "my_span").in_scope(|| { //! // perform some work in the context of `my_span`... @@ -261,8 +254,7 @@ //! construct one span and perform the entire loop inside of that span, like: //! //! ```rust -//! # #[macro_use] extern crate tracing; -//! # use tracing::Level; +//! # use tracing::{Level, span}; //! # let n = 1; //! let span = span!(Level::TRACE, "my_loop"); //! let _enter = span.enter(); @@ -273,8 +265,7 @@ //! ``` //! Or, should we create a new span for each iteration of the loop, as in: //! ```rust -//! # #[macro_use] extern crate tracing; -//! # use tracing::Level; +//! # use tracing::{Level, span}; //! # let n = 1u64; //! for i in 0..n { //! let span = span!(Level::TRACE, "my_loop", iteration = i); @@ -721,8 +712,7 @@ impl Span { /// # Examples /// /// ``` - /// #[macro_use] extern crate tracing; - /// # use tracing::Level; + /// # use tracing::{span, Level}; /// let span = span!(Level::INFO, "my_span"); /// let guard = span.enter(); /// @@ -737,7 +727,7 @@ impl Span { /// Guards need not be explicitly dropped: /// /// ``` - /// #[macro_use] extern crate tracing; + /// # use tracing::trace_span; /// fn my_function() -> String { /// // enter a span for the duration of this function. /// let span = trace_span!("my_function"); @@ -759,7 +749,7 @@ impl Span { /// entered: /// /// ``` - /// #[macro_use] extern crate tracing; + /// # use tracing::{info, info_span}; /// let span = info_span!("my_great_span"); /// /// { @@ -1073,8 +1063,7 @@ impl Span { /// # Examples /// /// ``` - /// # #[macro_use] extern crate tracing; - /// # use tracing::Level; + /// # use tracing::{trace, span, Level}; /// let my_span = span!(Level::TRACE, "my_span"); /// /// my_span.in_scope(|| {