diff --git a/src/allocator/free_list_allocator/mod.rs b/src/allocator/free_list_allocator/mod.rs index 44adcd5..9eeb760 100644 --- a/src/allocator/free_list_allocator/mod.rs +++ b/src/allocator/free_list_allocator/mod.rs @@ -5,12 +5,15 @@ use alloc::{ string::{String, ToString}, vec::Vec, }; -#[cfg(all(feature = "std", not(feature = "hashbrown")))] -use std::collections::{HashMap, HashSet}; + #[cfg(feature = "std")] -use std::{backtrace::Backtrace, sync::Arc}; +use std::{ + backtrace::Backtrace, + collections::{HashMap, HashSet}, + sync::Arc, +}; -#[cfg(all(not(feature = "std"), feature = "hashbrown"))] +#[cfg(feature = "hashbrown")] use hashbrown::{HashMap, HashSet}; use log::{log, Level}; diff --git a/src/allocator/mod.rs b/src/allocator/mod.rs index 9a3cf46..3bc3b33 100644 --- a/src/allocator/mod.rs +++ b/src/allocator/mod.rs @@ -10,7 +10,9 @@ use crate::result::*; pub(crate) mod dedicated_block_allocator; pub(crate) use dedicated_block_allocator::DedicatedBlockAllocator; +#[cfg(any(feature = "std", feature = "hashbrown"))] pub(crate) mod free_list_allocator; +#[cfg(any(feature = "std", feature = "hashbrown"))] pub(crate) use free_list_allocator::FreeListAllocator; #[derive(PartialEq, Copy, Clone, Debug)] diff --git a/src/lib.rs b/src/lib.rs index f99da25..771147e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -222,8 +222,8 @@ #[macro_use] extern crate alloc; -#[cfg(all(not(feature = "std"), not(feature = "hashbrown")))] -compile_error!("\"hashbrown\" feature should be enabled in \"no_std\" environment."); +#[cfg(all(feature = "std", feature = "hashbrown"))] +compile_error!("\"hashbrown\" feature should not be enabled in \"std\" environment."); #[cfg(all(not(feature = "std"), feature = "visualizer"))] compile_error!("Cannot enable \"visualizer\" feature in \"no_std\" environment.");