Skip to content

Commit 5da8f65

Browse files
committed
Remove trace feature for optional dependency
1 parent f0bab85 commit 5da8f65

File tree

5 files changed

+21
-22
lines changed

5 files changed

+21
-22
lines changed

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ categories = ["data-structures", "memory-management", "no-std", "rust-patterns"]
1313
alloc = []
1414
std = ["alloc", "thiserror"]
1515
global = ["std"]
16-
trace = ["tracing"]
1716

1817
[dependencies]
1918
thiserror = { version = "1.0.29", optional = true }

src/container/macros.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ macro_rules! coercible_trait {
1111
}
1212

1313
unsafe impl $crate::container::InnermostTypeId for dyn $trait {
14-
#[cfg_attr(feature = "trace", $crate::tracing::instrument(skip_all))]
14+
#[cfg_attr(feature = "tracing", $crate::tracing::instrument(skip_all))]
1515
fn innermost_type_id(
1616
&self,
1717
) -> Result<::core::any::TypeId, $crate::container::TypeIdDeterminationError> {
1818
let type_id = ::core::any::Any::type_id(self);
19-
#[cfg(feature = "trace")]
19+
#[cfg(feature = "tracing")]
2020
$crate::tracing::info!("found type_id {:?}", type_id);
2121
Ok(type_id)
2222
}
@@ -57,7 +57,7 @@ macro_rules! coercibles {
5757
where
5858
$t: ?::core::marker::Sized + $crate::container::InnermostTypeId,
5959
{
60-
#[cfg_attr(feature = "trace", tracing::instrument(skip_all, fields(
60+
#[cfg_attr(feature = "tracing", tracing::instrument(skip_all, fields(
6161
Self = ::core::any::type_name::<Self>(),
6262
)))]
6363
fn innermost_type_id(&$self) -> Result<::core::any::TypeId, $crate::container::TypeIdDeterminationError> $type
@@ -86,7 +86,7 @@ macro_rules! coercibles {
8686
where
8787
$t: ?::core::marker::Sized + $crate::container::Coercible,
8888
{
89-
#[cfg_attr(feature = "trace", tracing::instrument(skip_all, fields(
89+
#[cfg_attr(feature = "tracing", tracing::instrument(skip_all, fields(
9090
Self = ::core::any::type_name::<Self>(),
9191
U = ::core::any::type_name::<U>(),
9292
)))]

src/db/hash_map.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,17 +76,17 @@ unsafe impl<U> TypeDatabaseEntry<U> for HashMapTypeDatabaseEntry<U>
7676
where
7777
U: ?Sized,
7878
{
79-
#[cfg_attr(feature = "trace", tracing::instrument(skip(self, metadata)))]
79+
#[cfg_attr(feature = "tracing", tracing::instrument(skip(self, metadata)))]
8080
unsafe fn add(&mut self, type_id: TypeId, metadata: Metadata<U>) {
8181
let _ = self.0.insert(type_id, metadata);
8282
}
8383

84-
#[cfg_attr(feature = "trace", tracing::instrument(skip(self)))]
84+
#[cfg_attr(feature = "tracing", tracing::instrument(skip(self)))]
8585
fn contains(&self, type_id: TypeId) -> bool {
8686
self.0.contains_key(&type_id)
8787
}
8888

89-
#[cfg_attr(feature = "trace", tracing::instrument(skip(self)))]
89+
#[cfg_attr(feature = "tracing", tracing::instrument(skip(self)))]
9090
fn metadata(&self, type_id: TypeId) -> Option<&Metadata<U>> {
9191
self.0.get(&type_id)
9292
}
@@ -95,7 +95,7 @@ where
9595
unsafe impl TypeDatabase for HashMapTypeDatabase {
9696
type Entry<U: ?Sized> = HashMapTypeDatabaseEntry<U>;
9797

98-
#[cfg_attr(feature = "trace", tracing::instrument(skip_all, fields(
98+
#[cfg_attr(feature = "tracing", tracing::instrument(skip_all, fields(
9999
U = type_name::<U>(),
100100
)))]
101101
fn get_entry_mut<U>(&mut self) -> &mut Self::Entry<U>
@@ -111,7 +111,7 @@ unsafe impl TypeDatabase for HashMapTypeDatabase {
111111
}
112112
}
113113

114-
#[cfg_attr(feature = "trace", tracing::instrument(skip_all, fields(
114+
#[cfg_attr(feature = "tracing", tracing::instrument(skip_all, fields(
115115
U = type_name::<U>(),
116116
)))]
117117
fn get_entry<U>(&self) -> Option<&Self::Entry<U>>

src/db/mod.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use core::{
1717
};
1818
use error::{CastError, DatabaseEntryError, DatabaseError};
1919

20-
#[cfg(feature = "trace")]
20+
#[cfg(feature = "tracing")]
2121
use core::any::type_name;
2222

2323
/// A key-value store, where the key is the [`TypeId`] of a concrete Rust type
@@ -56,7 +56,7 @@ where
5656
U: ?Sized,
5757
{
5858
/// Register concrete type `I` as an implementor of `U`.
59-
#[cfg_attr(feature = "trace", tracing::instrument(skip_all, fields(
59+
#[cfg_attr(feature = "tracing", tracing::instrument(skip_all, fields(
6060
U = type_name::<U>(),
6161
I = type_name::<I>(),
6262
)))]
@@ -72,7 +72,7 @@ where
7272
}
7373

7474
/// Attempt to determine the concrete type of the given `data`.
75-
#[cfg_attr(feature = "trace", tracing::instrument(skip_all))]
75+
#[cfg_attr(feature = "tracing", tracing::instrument(skip_all))]
7676
fn concrete_type_id<P>(&self, data: &P) -> Result<TypeId, DatabaseEntryError<U, P>>
7777
where
7878
P: ?Sized + InnermostTypeId,
@@ -81,7 +81,7 @@ where
8181
}
8282

8383
/// Whether `data` is registered as an implementor of `U`.
84-
#[cfg_attr(feature = "trace", tracing::instrument(skip_all, fields(
84+
#[cfg_attr(feature = "tracing", tracing::instrument(skip_all, fields(
8585
P = type_name::<P>(),
8686
U = type_name::<U>(),
8787
)))]
@@ -95,7 +95,7 @@ where
9595

9696
/// Cast `pointer` to `P::Coerced<U>`, if registered as an implementor of
9797
/// `U`.
98-
#[cfg_attr(feature = "trace", tracing::instrument(skip_all, fields(
98+
#[cfg_attr(feature = "tracing", tracing::instrument(skip_all, fields(
9999
P = type_name::<P>(),
100100
U = type_name::<U>(),
101101
)))]
@@ -170,7 +170,7 @@ where
170170
{
171171
/// Returns a shared/immutable reference to the value of the entry that is
172172
/// keyed by `U`.
173-
#[cfg_attr(feature = "trace", tracing::instrument(skip_all, fields(
173+
#[cfg_attr(feature = "tracing", tracing::instrument(skip_all, fields(
174174
U = type_name::<U>(),
175175
)))]
176176
fn get_db_entry<U>(&self) -> Result<&Self::Entry<U>, DatabaseError<U>>

src/lib.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ pub mod container;
102102
pub mod db;
103103

104104
#[doc(hidden)]
105-
#[cfg(feature = "trace")]
105+
#[cfg(feature = "tracing")]
106106
pub use tracing;
107107

108108
use container::{Coerced, Coercible, InnermostTypeId, Metadata, Pointer};
@@ -115,7 +115,7 @@ use db::{
115115
#[cfg(any(feature = "global", doc))]
116116
use db::{error::DatabaseError, hash_map::DB};
117117

118-
#[cfg(feature = "trace")]
118+
#[cfg(feature = "tracing")]
119119
use core::any::type_name;
120120

121121
/// A type whose implementations can be dynamically determined.
@@ -125,7 +125,7 @@ where
125125
DB: TypeDatabaseExt,
126126
{
127127
/// Lookup whether `self`'s ultimate concrete type implements `U` in `db`.
128-
#[cfg_attr(feature = "trace", tracing::instrument(skip_all, fields(
128+
#[cfg_attr(feature = "tracing", tracing::instrument(skip_all, fields(
129129
Self = type_name::<Self>(),
130130
U = type_name::<U>(),
131131
)))]
@@ -146,7 +146,7 @@ where
146146
{
147147
/// Cast `self`'s ultimate concrete type to `U`, if registered as an
148148
/// implementor of `U` in `db`.
149-
#[cfg_attr(feature = "trace", tracing::instrument(skip_all, fields(
149+
#[cfg_attr(feature = "tracing", tracing::instrument(skip_all, fields(
150150
Self = type_name::<Self>(),
151151
U = type_name::<U>(),
152152
)))]
@@ -191,7 +191,7 @@ where
191191
{
192192
/// Lookup whether `self`'s ultimate concrete type implements `U` in the
193193
/// global [`DB`].
194-
#[cfg_attr(feature = "trace", tracing::instrument(skip_all))]
194+
#[cfg_attr(feature = "tracing", tracing::instrument(skip_all))]
195195
fn dyn_implements<U>(&self) -> Result<bool, DatabaseEntryError<U, &Self>>
196196
where
197197
U: 'static + ?Sized,
@@ -211,7 +211,7 @@ where
211211
{
212212
/// Cast `self`'s ultimate concrete type to `U`, if registered as an
213213
/// implementor of `U` in the global [`DB`].
214-
#[cfg_attr(feature = "trace", tracing::instrument(skip_all))]
214+
#[cfg_attr(feature = "tracing", tracing::instrument(skip_all))]
215215
fn dyn_cast<U>(self) -> Result<Self::Coerced<U>, CastError<U, Self>>
216216
where
217217
U: 'static + ?Sized,

0 commit comments

Comments
 (0)