Skip to content
Open
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
6 changes: 4 additions & 2 deletions tracing-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,15 @@ rust-version = "1.65.0"

[features]
default = ["std", "valuable?/std"]
std = ["once_cell"]
std = []
# used to be an implicit feature from an optional dependency
# FIXME: remove with the next breaking-change release
once_cell = []

[badges]
maintenance = { status = "actively-developed" }

[dependencies]
once_cell = { version = "1.13.0", optional = true }

[target.'cfg(tracing_unstable)'.dependencies]
valuable = { version = "0.1.0", optional = true, default-features = false }
Expand Down
8 changes: 3 additions & 5 deletions tracing-core/src/callsite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ use crate::stdlib::{
};
use crate::{
dispatcher::Dispatch,
lazy::Lazy,
metadata::{LevelFilter, Metadata},
subscriber::Interest,
};
Expand Down Expand Up @@ -260,7 +259,7 @@ static CALLSITES: Callsites = Callsites {

static DISPATCHERS: Dispatchers = Dispatchers::new();

static LOCKED_CALLSITES: Lazy<Mutex<Vec<&'static dyn Callsite>>> = Lazy::new(Default::default);
static LOCKED_CALLSITES: Mutex<Vec<&'static dyn Callsite>> = Mutex::new(Vec::new());

struct Callsites {
list_head: AtomicPtr<DefaultCallsite>,
Expand Down Expand Up @@ -515,7 +514,7 @@ mod private {

#[cfg(feature = "std")]
mod dispatchers {
use crate::{dispatcher, lazy::Lazy};
use crate::dispatcher;
use std::sync::{
atomic::{AtomicBool, Ordering},
RwLock, RwLockReadGuard, RwLockWriteGuard,
Expand All @@ -525,8 +524,7 @@ mod dispatchers {
has_just_one: AtomicBool,
}

static LOCKED_DISPATCHERS: Lazy<RwLock<Vec<dispatcher::Registrar>>> =
Lazy::new(Default::default);
static LOCKED_DISPATCHERS: RwLock<Vec<dispatcher::Registrar>> = RwLock::new(Vec::new());

pub(super) enum Rebuilder<'a> {
JustOne,
Expand Down
76 changes: 0 additions & 76 deletions tracing-core/src/lazy.rs

This file was deleted.

2 changes: 0 additions & 2 deletions tracing-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,8 +261,6 @@ macro_rules! metadata {
};
}

pub(crate) mod lazy;

// Trimmed-down vendored version of spin 0.5.2 (0387621)
// Dependency of no_std lazy_static, not required in a std build
#[cfg(not(feature = "std"))]
Expand Down
10 changes: 5 additions & 5 deletions tracing-core/src/stdlib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@ mod no_std {
}

impl<T> Mutex<T> {
// pub(crate) fn new(data: T) -> Self {
// Self {
// inner: crate::spin::Mutex::new(data),
// }
// }
pub(crate) const fn new(data: T) -> Self {
Self {
inner: crate::spin::Mutex::new(data),
}
}

pub(crate) fn lock(&self) -> Result<MutexGuard<'_, T>, ()> {
Ok(self.inner.lock())
Expand Down
Loading