Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: remove #[macro_use] extern crate #1737

Merged
merged 2 commits into from
Nov 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions tracing-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 { }
Expand Down
4 changes: 1 addition & 3 deletions tracing/src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")
// /// #}
Expand Down
33 changes: 11 additions & 22 deletions tracing/src/span.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
//!
Expand All @@ -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);
//!
Expand Down Expand Up @@ -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
Expand All @@ -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");
//!
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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`...
Expand Down Expand Up @@ -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();
Expand All @@ -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);
Expand Down Expand Up @@ -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();
///
Expand All @@ -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");
Expand All @@ -759,7 +749,7 @@ impl Span {
/// entered:
///
/// ```
/// #[macro_use] extern crate tracing;
/// # use tracing::{info, info_span};
/// let span = info_span!("my_great_span");
///
/// {
Expand Down Expand Up @@ -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(|| {
Expand Down