diff options
author | HampusM <hampus@hampusmat.com> | 2023-08-16 18:46:09 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2023-08-16 18:46:09 +0200 |
commit | 9e1edb7c0e1021a02766bd539c151eefc53ee0ef (patch) | |
tree | daeab4921a991cd3647f9f1be9d27e862c892c8c /src | |
parent | cc48563f774423fe591911fed413cf3db4ba326e (diff) |
chore: fix warnings when only the async feature enabled
Diffstat (limited to 'src')
-rw-r--r-- | src/di_container/asynchronous/mod.rs | 4 | ||||
-rw-r--r-- | src/provider/async.rs | 1 | ||||
-rw-r--r-- | src/test_utils.rs | 4 |
3 files changed, 6 insertions, 3 deletions
diff --git a/src/di_container/asynchronous/mod.rs b/src/di_container/asynchronous/mod.rs index d330f4a..0db6782 100644 --- a/src/di_container/asynchronous/mod.rs +++ b/src/di_container/asynchronous/mod.rs @@ -65,7 +65,7 @@ use crate::private::cast::arc::CastArc; use crate::private::cast::boxed::CastBox; use crate::private::cast::error::CastError; use crate::provider::r#async::{AsyncProvidable, IAsyncProvider}; -use crate::ptr::{SomePtr, TransientPtr}; +use crate::ptr::SomePtr; use crate::util::use_dependency_history; use_dependency_history!(); @@ -306,6 +306,7 @@ impl AsyncDIContainer #[cfg(feature = "factory")] AsyncProvidable::DefaultFactory(binding) => { use crate::private::factory::IThreadsafeFactory; + use crate::ptr::TransientPtr; let default_factory = Self::cast_factory_binding::< dyn IThreadsafeFactory< @@ -319,6 +320,7 @@ impl AsyncDIContainer #[cfg(feature = "factory")] AsyncProvidable::AsyncDefaultFactory(binding) => { use crate::private::factory::IThreadsafeFactory; + use crate::ptr::TransientPtr; let async_default_factory = Self::cast_factory_binding::< dyn IThreadsafeFactory< diff --git a/src/provider/async.rs b/src/provider/async.rs index 38600c9..c2d0bfe 100644 --- a/src/provider/async.rs +++ b/src/provider/async.rs @@ -188,6 +188,7 @@ where } } +#[cfg(feature = "factory")] #[derive(Clone, Copy)] pub enum AsyncFactoryVariant { diff --git a/src/test_utils.rs b/src/test_utils.rs index 2bc1671..3d51ffe 100644 --- a/src/test_utils.rs +++ b/src/test_utils.rs @@ -496,7 +496,7 @@ pub mod mocks } } -#[cfg(feature = "async")] +#[cfg(all(feature = "async", feature = "factory"))] macro_rules! async_closure { (|$($args: ident),*| { $($inner: stmt);* }) => { Box::new(|$($args),*| { @@ -510,5 +510,5 @@ macro_rules! async_closure { }; } -#[cfg(feature = "async")] +#[cfg(all(feature = "async", feature = "factory"))] pub(crate) use async_closure; |