diff --git a/module/core/collection_tools/Readme.md b/module/core/collection_tools/Readme.md index 1eae122a75..74d990ea1e 100644 --- a/module/core/collection_tools/Readme.md +++ b/module/core/collection_tools/Readme.md @@ -120,7 +120,7 @@ While strict macros require you to have all members of the same type, more relax For example: ```rust -# #[ cfg( all( feature = "enabled", feature = "collection_into_constructors" ) ) ] +# #[ cfg( all( feature = "enabled", feature = "collection_into_constructors", any( not( feature = "no_std" ), feature = "use_alloc" ) ) ) ] # { use std::borrow::Cow; let vec : Vec< String > = collection_tools::into_vec!( "&str", "String".to_string(), Cow::from( "Cow" ) ); diff --git a/module/core/collection_tools/src/lib.rs b/module/core/collection_tools/src/lib.rs index 93f360a73e..d37a4bcb8f 100644 --- a/module/core/collection_tools/src/lib.rs +++ b/module/core/collection_tools/src/lib.rs @@ -4,6 +4,7 @@ #![ doc( html_root_url = "https://docs.rs/collection_tools/latest/collection_tools/" ) ] #![ doc = include_str!( concat!( env!( "CARGO_MANIFEST_DIR" ), "/", "Readme.md" ) ) ] +#[ cfg( any( not( feature = "no_std" ), feature = "use_alloc" ) ) ] extern crate alloc; // qqq : make subdirectory for each container -- done @@ -12,7 +13,10 @@ extern crate alloc; /// Module containing all collection macros #[ cfg( feature = "enabled" ) ] +#[ cfg( any( not( feature = "no_std" ), feature = "use_alloc" ) ) ] mod collections; +#[ cfg( feature = "enabled" ) ] +#[ cfg( any( not( feature = "no_std" ), feature = "use_alloc" ) ) ] pub use collections::*; /// Namespace with dependencies. diff --git a/module/core/collection_tools/tests/inc/bmap.rs b/module/core/collection_tools/tests/inc/bmap.rs index d08e871a01..f9034314aa 100644 --- a/module/core/collection_tools/tests/inc/bmap.rs +++ b/module/core/collection_tools/tests/inc/bmap.rs @@ -1,6 +1,5 @@ use super::*; -#[ cfg( any( feature = "use_alloc", not( feature = "no_std" ) ) ) ] #[ test ] fn reexport() { @@ -13,8 +12,8 @@ fn reexport() } -#[ test ] #[ cfg( feature = "collection_constructors" ) ] +#[ test ] fn constructor() { @@ -51,7 +50,6 @@ fn into_constructor() } -#[ cfg( any( not( feature = "no_std" ), feature = "use_alloc" ) ) ] #[ test ] fn iters() { diff --git a/module/core/collection_tools/tests/inc/bset.rs b/module/core/collection_tools/tests/inc/bset.rs index 11a5c49a58..b08f7593c4 100644 --- a/module/core/collection_tools/tests/inc/bset.rs +++ b/module/core/collection_tools/tests/inc/bset.rs @@ -1,6 +1,5 @@ use super::*; -#[ cfg( any( feature = "use_alloc", not( feature = "no_std" ) ) ) ] #[ test ] fn reexport() { @@ -12,8 +11,8 @@ fn reexport() } -#[ test ] #[ cfg( feature = "collection_constructors" ) ] +#[ test ] fn constructor() { @@ -31,8 +30,8 @@ fn constructor() } -#[ test ] #[ cfg( feature = "collection_into_constructors" ) ] +#[ test ] fn into_constructor() { @@ -50,7 +49,6 @@ fn into_constructor() } -#[ cfg( any( not( feature = "no_std" ), feature = "use_alloc" ) ) ] #[ test ] fn iters() { diff --git a/module/core/collection_tools/tests/inc/heap.rs b/module/core/collection_tools/tests/inc/heap.rs index 632899d65f..a342548cfc 100644 --- a/module/core/collection_tools/tests/inc/heap.rs +++ b/module/core/collection_tools/tests/inc/heap.rs @@ -1,6 +1,5 @@ use super::*; -#[ cfg( any( feature = "use_alloc", not( feature = "no_std" ) ) ) ] #[ test ] fn reexport() { @@ -13,8 +12,8 @@ fn reexport() } -#[ test ] #[ cfg( feature = "collection_constructors" ) ] +#[ test ] fn constructor() { @@ -32,8 +31,8 @@ fn constructor() } -#[ test ] #[ cfg( feature = "collection_into_constructors" ) ] +#[ test ] fn into_constructor() { @@ -51,7 +50,6 @@ fn into_constructor() } -#[ cfg( any( not( feature = "no_std" ), feature = "use_alloc" ) ) ] #[ test ] fn iters() { diff --git a/module/core/collection_tools/tests/inc/hmap.rs b/module/core/collection_tools/tests/inc/hmap.rs index 04c8223e24..1d5d0027d1 100644 --- a/module/core/collection_tools/tests/inc/hmap.rs +++ b/module/core/collection_tools/tests/inc/hmap.rs @@ -1,6 +1,5 @@ use super::*; -#[ cfg( any( feature = "use_alloc", not( feature = "no_std" ) ) ) ] #[ test ] fn reexport() { @@ -21,8 +20,8 @@ fn reexport() } -#[ test ] #[ cfg( feature = "collection_constructors" ) ] +#[ test ] fn constructor() { @@ -41,8 +40,8 @@ fn constructor() } -#[ test ] #[ cfg( feature = "collection_into_constructors" ) ] +#[ test ] fn into_constructor() { @@ -61,7 +60,6 @@ fn into_constructor() } -#[ cfg( any( not( feature = "no_std" ), feature = "use_alloc" ) ) ] #[ test ] fn iters() { diff --git a/module/core/collection_tools/tests/inc/hset.rs b/module/core/collection_tools/tests/inc/hset.rs index 8b8ec3d2b4..d5a0ad5ed9 100644 --- a/module/core/collection_tools/tests/inc/hset.rs +++ b/module/core/collection_tools/tests/inc/hset.rs @@ -1,6 +1,5 @@ use super::*; -#[ cfg( any( feature = "use_alloc", not( feature = "no_std" ) ) ) ] #[ test ] fn reexport() { @@ -19,8 +18,8 @@ fn reexport() } -#[ test ] #[ cfg( feature = "collection_constructors" ) ] +#[ test ] fn constructor() { @@ -38,8 +37,8 @@ fn constructor() } -#[ test ] #[ cfg( feature = "collection_into_constructors" ) ] +#[ test ] fn into_constructor() { @@ -57,7 +56,6 @@ fn into_constructor() } -#[ cfg( any( not( feature = "no_std" ), feature = "use_alloc" ) ) ] #[ test ] fn iters() { diff --git a/module/core/collection_tools/tests/inc/list.rs b/module/core/collection_tools/tests/inc/list.rs index b89daaf6f3..648cdf8061 100644 --- a/module/core/collection_tools/tests/inc/list.rs +++ b/module/core/collection_tools/tests/inc/list.rs @@ -1,6 +1,5 @@ use super::*; -#[ cfg( any( feature = "use_alloc", not( feature = "no_std" ) ) ) ] #[ test ] fn reexport() { @@ -12,8 +11,8 @@ fn reexport() } -#[ test ] #[ cfg( feature = "collection_constructors" ) ] +#[ test ] fn constructor() { @@ -50,7 +49,6 @@ fn into_constructor() } -#[ cfg( any( not( feature = "no_std" ), feature = "use_alloc" ) ) ] #[ test ] fn iters() { diff --git a/module/core/collection_tools/tests/inc/vec.rs b/module/core/collection_tools/tests/inc/vec.rs index d93062e9be..ff68b33ec8 100644 --- a/module/core/collection_tools/tests/inc/vec.rs +++ b/module/core/collection_tools/tests/inc/vec.rs @@ -1,6 +1,5 @@ use super::*; -#[ cfg( any( feature = "use_alloc", not( feature = "no_std" ) ) ) ] #[ test ] fn reexport() { @@ -64,7 +63,6 @@ fn into_constructor() } // qqq : implement similar test for all containers -- done -#[ cfg( any( not( feature = "no_std" ), feature = "use_alloc" ) ) ] #[ test ] fn iters() { diff --git a/module/core/collection_tools/tests/inc/vecd.rs b/module/core/collection_tools/tests/inc/vecd.rs index 7e3260fd8b..5692b56fa9 100644 --- a/module/core/collection_tools/tests/inc/vecd.rs +++ b/module/core/collection_tools/tests/inc/vecd.rs @@ -1,6 +1,5 @@ use super::*; -#[ cfg( any( feature = "use_alloc", not( feature = "no_std" ) ) ) ] #[ test ] fn reexport() { @@ -50,7 +49,6 @@ fn into_constructor() } -#[ cfg( any( not( feature = "no_std" ), feature = "use_alloc" ) ) ] #[ test ] fn iters() { diff --git a/module/core/collection_tools/tests/tests.rs b/module/core/collection_tools/tests/tests.rs index eb256d2f63..a36c5debec 100644 --- a/module/core/collection_tools/tests/tests.rs +++ b/module/core/collection_tools/tests/tests.rs @@ -10,4 +10,5 @@ use test_tools::exposed::*; use ::collection_tools as the_module; #[ cfg( feature = "enabled" ) ] +#[ cfg( any( feature = "use_alloc", not( feature = "no_std" ) ) ) ] mod inc;