Skip to content

Commit

Permalink
chore: fix warnings about unexpected cfg(feature) values (tokio-rs#…
Browse files Browse the repository at this point in the history
…2968)

* futures: Remove executor::futures_preview module

The cfg for it was impossible to enable as of
tokio-rs#441.

* subscriber: Fix cfgs for nu-ansi-term

Previously, enabling this optional dependency did not do anything.

* Unconditionally ignore flaky tests

No need to use a custom cfg to run off-by-default tests.

* tower: Delete unused code

It might be possible to make it work with tower_make instead, but that
crate looks to be unmaintained (no longer present in the tower repo
which is specified as the repository URL) so it should likely just be
removed as a dependency.
  • Loading branch information
svix-jplatte committed May 21, 2024
1 parent 690a9a6 commit d61b039
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 164 deletions.
121 changes: 0 additions & 121 deletions tracing-futures/src/executor/futures_preview.rs

This file was deleted.

5 changes: 0 additions & 5 deletions tracing-futures/src/executor/mod.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
#[cfg(feature = "futures-01")]
mod futures_01;

#[cfg(feature = "futures_preview")]
mod futures_preview;
#[cfg(feature = "futures_preview")]
pub use self::futures_preview::*;

#[cfg(feature = "futures-03")]
mod futures_03;
#[cfg(feature = "futures-03")]
Expand Down
14 changes: 7 additions & 7 deletions tracing-subscriber/src/filter/env/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,15 +210,15 @@ impl Builder {
}

if !disabled.is_empty() {
#[cfg(feature = "nu_ansi_term")]
#[cfg(feature = "nu-ansi-term")]
use nu_ansi_term::{Color, Style};
// NOTE: We can't use a configured `MakeWriter` because the EnvFilter
// has no knowledge of any underlying subscriber or collector, which
// may or may not use a `MakeWriter`.
let warn = |msg: &str| {
#[cfg(not(feature = "nu_ansi_term"))]
#[cfg(not(feature = "nu-ansi-term"))]
let msg = format!("warning: {}", msg);
#[cfg(feature = "nu_ansi_term")]
#[cfg(feature = "nu-ansi-term")]
let msg = {
let bold = Style::new().bold();
let mut warning = Color::Yellow.paint("warning");
Expand All @@ -228,9 +228,9 @@ impl Builder {
eprintln!("{}", msg);
};
let ctx_prefixed = |prefix: &str, msg: &str| {
#[cfg(not(feature = "nu_ansi_term"))]
#[cfg(not(feature = "nu-ansi-term"))]
let msg = format!("{} {}", prefix, msg);
#[cfg(feature = "nu_ansi_term")]
#[cfg(feature = "nu-ansi-term")]
let msg = {
let mut equal = Color::Fixed(21).paint("="); // dark blue
equal.style_ref_mut().is_bold = true;
Expand All @@ -241,9 +241,9 @@ impl Builder {
let ctx_help = |msg| ctx_prefixed("help:", msg);
let ctx_note = |msg| ctx_prefixed("note:", msg);
let ctx = |msg: &str| {
#[cfg(not(feature = "nu_ansi_term"))]
#[cfg(not(feature = "nu-ansi-term"))]
let msg = format!("note: {}", msg);
#[cfg(feature = "nu_ansi_term")]
#[cfg(feature = "nu-ansi-term")]
let msg = {
let mut pipe = Color::Fixed(21).paint("|");
pipe.style_ref_mut().is_bold = true;
Expand Down
4 changes: 2 additions & 2 deletions tracing-subscriber/tests/field_filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use tracing_mock::*;
use tracing_subscriber::{filter::EnvFilter, prelude::*};

#[test]
#[cfg_attr(not(flaky_tests), ignore)]
#[ignore] // flaky, use `cargo test -- --ignored` or `--include-ignored` to run
fn field_filter_events() {
let filter: EnvFilter = "[{thing}]=debug".parse().expect("filter should parse");
let (subscriber, finished) = collector::mock()
Expand Down Expand Up @@ -35,7 +35,7 @@ fn field_filter_events() {
}

#[test]
#[cfg_attr(not(flaky_tests), ignore)]
#[ignore] // flaky, use `cargo test -- --ignored` or `--include-ignored` to run
fn field_filter_spans() {
let filter: EnvFilter = "[{enabled=true}]=debug"
.parse()
Expand Down
25 changes: 0 additions & 25 deletions tracing-tower/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,33 +71,8 @@ where
}
}

#[cfg(feature = "tower-util")]
#[cfg_attr(docsrs, doc(cfg(feature = "tower-util")))]
pub trait InstrumentMake<T, R>
where
Self: tower_util::MakeService<T, R> + Sized,
{
fn with_traced_service<G>(self, get_span: G) -> service_span::MakeService<Self, T, R, G>
where
G: GetSpan<T>,
{
service_span::MakeService::new(self, get_span)
}

fn with_traced_requests<G>(self, get_span: G) -> request_span::MakeService<Self, R, G>
where
G: GetSpan<R> + Clone,
{
request_span::MakeService::new(self, get_span)
}
}

impl<S, R> InstrumentableService<R> for S where S: Service<R> + Sized {}

#[cfg(feature = "tower-util")]
#[cfg_attr(docsrs, doc(cfg(feature = "tower-util")))]
impl<M, T, R> InstrumentMake<T, R> for M where M: tower_util::MakeService<T, R> {}

pub trait GetSpan<T>: crate::sealed::Sealed<T> {
fn span_for(&self, target: &T) -> tracing::Span;
}
Expand Down
4 changes: 0 additions & 4 deletions tracing-tower/src/service_span.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ pub struct Service<S> {
#[cfg_attr(docsrs, doc(cfg(feature = "tower-layer")))]
pub use self::layer::*;

#[cfg(feature = "tower-util")]
#[cfg_attr(docsrs, doc(cfg(feature = "tower-util")))]
pub use self::make::MakeService;

#[cfg(feature = "tower-layer")]
#[cfg_attr(docsrs, doc(cfg(feature = "tower-layer")))]
mod layer {
Expand Down

0 comments on commit d61b039

Please sign in to comment.