diff --git a/Cargo.toml b/Cargo.toml index 2f3c7fa..63c3965 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,7 +17,6 @@ name = "codebreaker" [dependencies] bytemuck = "1" -cfg-if = "1" num-bigint = "0.4" [dev-dependencies] diff --git a/src/lib.rs b/src/lib.rs index 64dad74..2e8e64c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -36,34 +36,21 @@ #[cfg(doctest)] doc_comment::doctest!("../README.md", readme); -cfg_if::cfg_if! { - if #[cfg(feature = "std")] { - extern crate std; - mod std_alloc { - pub use std::{ - fmt, - string::{String, ToString}, - vec, - vec::Vec, - }; - } - } else { - extern crate alloc; - mod std_alloc { - pub use alloc::{ - fmt, - string::{String, ToString}, - vec, - vec::Vec, - }; - } - } -} - pub mod cb1; pub mod cb7; mod rc4; +#[cfg(test)] +mod std_alloc { + #[cfg(feature = "std")] + extern crate std as alloc; + + #[cfg(not(feature = "std"))] + extern crate alloc; + + pub use alloc::{fmt, vec, vec::Vec}; +} + use cb7::{is_beefcode, Cb7}; #[derive(Debug, Clone, Copy, PartialEq, Eq)]