Skip to content

Commit

Permalink
Merge pull request #1343 from YBoy-git/collection_tools_no_std_fix
Browse files Browse the repository at this point in the history
READY : (collection_tools) : no_std fix
  • Loading branch information
Wandalen authored May 19, 2024
2 parents 2203d9c + ad81197 commit f63df17
Show file tree
Hide file tree
Showing 11 changed files with 16 additions and 27 deletions.
2 changes: 1 addition & 1 deletion module/core/collection_tools/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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" ) );
Expand Down
4 changes: 4 additions & 0 deletions module/core/collection_tools/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand Down
4 changes: 1 addition & 3 deletions module/core/collection_tools/tests/inc/bmap.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use super::*;

#[ cfg( any( feature = "use_alloc", not( feature = "no_std" ) ) ) ]
#[ test ]
fn reexport()
{
Expand All @@ -13,8 +12,8 @@ fn reexport()

}

#[ test ]
#[ cfg( feature = "collection_constructors" ) ]
#[ test ]
fn constructor()
{

Expand Down Expand Up @@ -51,7 +50,6 @@ fn into_constructor()

}

#[ cfg( any( not( feature = "no_std" ), feature = "use_alloc" ) ) ]
#[ test ]
fn iters()
{
Expand Down
6 changes: 2 additions & 4 deletions module/core/collection_tools/tests/inc/bset.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use super::*;

#[ cfg( any( feature = "use_alloc", not( feature = "no_std" ) ) ) ]
#[ test ]
fn reexport()
{
Expand All @@ -12,8 +11,8 @@ fn reexport()

}

#[ test ]
#[ cfg( feature = "collection_constructors" ) ]
#[ test ]
fn constructor()
{

Expand All @@ -31,8 +30,8 @@ fn constructor()

}

#[ test ]
#[ cfg( feature = "collection_into_constructors" ) ]
#[ test ]
fn into_constructor()
{

Expand All @@ -50,7 +49,6 @@ fn into_constructor()

}

#[ cfg( any( not( feature = "no_std" ), feature = "use_alloc" ) ) ]
#[ test ]
fn iters()
{
Expand Down
6 changes: 2 additions & 4 deletions module/core/collection_tools/tests/inc/heap.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use super::*;

#[ cfg( any( feature = "use_alloc", not( feature = "no_std" ) ) ) ]
#[ test ]
fn reexport()
{
Expand All @@ -13,8 +12,8 @@ fn reexport()

}

#[ test ]
#[ cfg( feature = "collection_constructors" ) ]
#[ test ]
fn constructor()
{

Expand All @@ -32,8 +31,8 @@ fn constructor()

}

#[ test ]
#[ cfg( feature = "collection_into_constructors" ) ]
#[ test ]
fn into_constructor()
{

Expand All @@ -51,7 +50,6 @@ fn into_constructor()

}

#[ cfg( any( not( feature = "no_std" ), feature = "use_alloc" ) ) ]
#[ test ]
fn iters()
{
Expand Down
6 changes: 2 additions & 4 deletions module/core/collection_tools/tests/inc/hmap.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use super::*;

#[ cfg( any( feature = "use_alloc", not( feature = "no_std" ) ) ) ]
#[ test ]
fn reexport()
{
Expand All @@ -21,8 +20,8 @@ fn reexport()

}

#[ test ]
#[ cfg( feature = "collection_constructors" ) ]
#[ test ]
fn constructor()
{

Expand All @@ -41,8 +40,8 @@ fn constructor()

}

#[ test ]
#[ cfg( feature = "collection_into_constructors" ) ]
#[ test ]
fn into_constructor()
{

Expand All @@ -61,7 +60,6 @@ fn into_constructor()

}

#[ cfg( any( not( feature = "no_std" ), feature = "use_alloc" ) ) ]
#[ test ]
fn iters()
{
Expand Down
6 changes: 2 additions & 4 deletions module/core/collection_tools/tests/inc/hset.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use super::*;

#[ cfg( any( feature = "use_alloc", not( feature = "no_std" ) ) ) ]
#[ test ]
fn reexport()
{
Expand All @@ -19,8 +18,8 @@ fn reexport()

}

#[ test ]
#[ cfg( feature = "collection_constructors" ) ]
#[ test ]
fn constructor()
{

Expand All @@ -38,8 +37,8 @@ fn constructor()

}

#[ test ]
#[ cfg( feature = "collection_into_constructors" ) ]
#[ test ]
fn into_constructor()
{

Expand All @@ -57,7 +56,6 @@ fn into_constructor()

}

#[ cfg( any( not( feature = "no_std" ), feature = "use_alloc" ) ) ]
#[ test ]
fn iters()
{
Expand Down
4 changes: 1 addition & 3 deletions module/core/collection_tools/tests/inc/list.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use super::*;

#[ cfg( any( feature = "use_alloc", not( feature = "no_std" ) ) ) ]
#[ test ]
fn reexport()
{
Expand All @@ -12,8 +11,8 @@ fn reexport()

}

#[ test ]
#[ cfg( feature = "collection_constructors" ) ]
#[ test ]
fn constructor()
{

Expand Down Expand Up @@ -50,7 +49,6 @@ fn into_constructor()

}

#[ cfg( any( not( feature = "no_std" ), feature = "use_alloc" ) ) ]
#[ test ]
fn iters()
{
Expand Down
2 changes: 0 additions & 2 deletions module/core/collection_tools/tests/inc/vec.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use super::*;

#[ cfg( any( feature = "use_alloc", not( feature = "no_std" ) ) ) ]
#[ test ]
fn reexport()
{
Expand Down Expand Up @@ -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()
{
Expand Down
2 changes: 0 additions & 2 deletions module/core/collection_tools/tests/inc/vecd.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use super::*;

#[ cfg( any( feature = "use_alloc", not( feature = "no_std" ) ) ) ]
#[ test ]
fn reexport()
{
Expand Down Expand Up @@ -50,7 +49,6 @@ fn into_constructor()

}

#[ cfg( any( not( feature = "no_std" ), feature = "use_alloc" ) ) ]
#[ test ]
fn iters()
{
Expand Down
1 change: 1 addition & 0 deletions module/core/collection_tools/tests/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

0 comments on commit f63df17

Please sign in to comment.