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

subscriber: Stop using prelude imports in doctests #1422

Merged
merged 2 commits into from
Jun 7, 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
2 changes: 1 addition & 1 deletion examples/examples/toggle-subscribers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
///
use clap::{App, Arg};
use tracing::info;
use tracing_subscriber::{prelude::__tracing_subscriber_SubscriberExt, util::SubscriberInitExt};
use tracing_subscriber::{subscribe::CollectExt, util::SubscriberInitExt};

#[path = "fmt/yak_shave.rs"]
mod yak_shave;
Expand Down
6 changes: 3 additions & 3 deletions tracing-subscriber/src/fmt/fmt_subscriber.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use tracing_core::{
///
/// ```rust
/// use tracing_subscriber::{fmt, Registry};
/// use tracing_subscriber::prelude::*;
/// use tracing_subscriber::subscribe::CollectExt;
///
/// let collector = Registry::default()
/// .with(fmt::Subscriber::default());
Expand All @@ -35,7 +35,7 @@ use tracing_core::{
///
/// ```rust
/// use tracing_subscriber::{fmt, Registry};
/// use tracing_subscriber::prelude::*;
/// use tracing_subscriber::subscribe::CollectExt;
///
/// let fmt_subscriber = fmt::subscriber()
/// .with_target(false) // don't include event targets when logging
Expand All @@ -49,7 +49,7 @@ use tracing_core::{
///
/// ```rust
/// use tracing_subscriber::fmt::{self, format, time};
/// use tracing_subscriber::prelude::*;
/// use tracing_subscriber::Subscribe;
///
/// let fmt = format().with_timer(time::Uptime::default());
/// let fmt_subscriber = fmt::subscriber()
Expand Down
9 changes: 5 additions & 4 deletions tracing-subscriber/src/fmt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,8 @@
//!
//! ```rust
//! use tracing_subscriber::{fmt, EnvFilter};
//! use tracing_subscriber::prelude::*;
//! use tracing_subscriber::subscribe::CollectExt;
//! use tracing_subscriber::util::SubscriberInitExt;
//!
//! let fmt_subscriber = fmt::subscriber()
//! .with_target(false);
Expand Down Expand Up @@ -846,12 +847,12 @@ impl<N, E, F, W> CollectorBuilder<N, E, F, W> {
/// For example:
/// ```rust
/// use tracing_subscriber::fmt::format;
/// use tracing_subscriber::prelude::*;
/// use tracing_subscriber::field::MakeExt;
///
/// let formatter =
/// // Construct a custom formatter for `Debug` fields
/// format::debug_fn(|writer, field, value| write!(writer, "{}: {:?}", field, value))
/// // Use the `tracing_subscriber::MakeFmtExt` trait to wrap the
/// // Use the `tracing_subscriber::MakeExt` trait to wrap the
/// // formatter so that a delimiter is added between fields.
/// .delimited(", ");
///
Expand Down Expand Up @@ -982,7 +983,7 @@ impl<N, E, F, W> CollectorBuilder<N, E, F, W> {
///
/// ```
/// use tracing::Level;
/// use tracing_subscriber::prelude::*;
/// use tracing_subscriber::util::SubscriberInitExt;
///
/// let builder = tracing_subscriber::fmt()
/// // Set a max level filter on the collector
Expand Down
10 changes: 2 additions & 8 deletions tracing-subscriber/src/prelude.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,6 @@
//! This brings into scope a number of extension traits that define methods on
//! types defined here and in other crates.

pub use crate::field::{
MakeExt as __tracing_subscriber_field_MakeExt,
RecordFields as __tracing_subscriber_field_RecordFields,
};
pub use crate::subscribe::{
CollectExt as __tracing_subscriber_SubscriberExt, Subscribe as __tracing_subscriber_Layer,
};

pub use crate::field::{MakeExt as _, RecordFields as _};
pub use crate::subscribe::{CollectExt as _, Subscribe as _};
pub use crate::util::SubscriberInitExt as _;
4 changes: 2 additions & 2 deletions tracing-subscriber/src/subscribe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ use std::{any::TypeId, marker::PhantomData, ptr::NonNull};
/// For example:
/// ```rust
/// use tracing_subscriber::Subscribe;
/// use tracing_subscriber::prelude::*;
/// use tracing_subscriber::subscribe::CollectExt;
/// use tracing::Collect;
///
/// pub struct MySubscriber {
Expand Down Expand Up @@ -94,7 +94,7 @@ use std::{any::TypeId, marker::PhantomData, ptr::NonNull};
/// Multiple `Subscriber`s may be composed in the same manner:
/// ```rust
/// # use tracing_subscriber::Subscribe;
/// # use tracing_subscriber::prelude::*;
/// # use tracing_subscriber::subscribe::CollectExt;
/// # use tracing::Collect;
/// pub struct MyOtherSubscriber {
/// // ...
Expand Down