From 7d3bff82d662cc1e021451cb16ccb88a2f741e32 Mon Sep 17 00:00:00 2001 From: Eliza Weisman Date: Thu, 21 Oct 2021 11:47:15 -0700 Subject: [PATCH] subscriber: fix imports with `std` only Turns out that if `std` is enabled but `smallvec` is not, we have some missing imports. This fixes the build when a crate passes `default-features = "false` but then enables `std`. Signed-off-by: Eliza Weisman --- tracing-subscriber/src/filter/directive.rs | 8 ++++---- tracing-subscriber/src/registry/mod.rs | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/tracing-subscriber/src/filter/directive.rs b/tracing-subscriber/src/filter/directive.rs index c56147c6..dd6b063c 100644 --- a/tracing-subscriber/src/filter/directive.rs +++ b/tracing-subscriber/src/filter/directive.rs @@ -1,9 +1,9 @@ use crate::filter::level::{self, LevelFilter}; +#[cfg(not(feature = "smallvec"))] +use alloc::vec; #[cfg(not(feature = "std"))] -use alloc::{ - string::String, - vec::{self, Vec}, -}; +use alloc::{string::String, vec::Vec}; + use core::{cmp::Ordering, fmt, iter::FromIterator, slice, str::FromStr}; use tracing_core::Metadata; /// Indicates that a string could not be parsed as a filtering directive. diff --git a/tracing-subscriber/src/registry/mod.rs b/tracing-subscriber/src/registry/mod.rs index b2a6af4a..1eadc160 100644 --- a/tracing-subscriber/src/registry/mod.rs +++ b/tracing-subscriber/src/registry/mod.rs @@ -234,8 +234,9 @@ pub struct Scope<'a, R> { feature! { #![any(feature = "alloc", feature = "std")] - #[cfg(not(feature = "std"))] + #[cfg(not(feature = "smallvec"))] use alloc::vec::{self, Vec}; + use core::{fmt,iter}; /// An iterator over the parents of a span, ordered from root to leaf.