From 5416f638d473848bbfe21df91c366e4882a9a0b9 Mon Sep 17 00:00:00 2001 From: "Kevin R. Thornton" Date: Sun, 2 Jul 2023 10:30:59 -0700 Subject: [PATCH] refactor: re-export rand/rand_distr from core --- forrustts-core/Cargo.toml | 4 ++-- forrustts-core/src/lib.rs | 4 +++- forrustts-genetics/Cargo.toml | 4 +--- forrustts-genetics/src/genetic_maps.rs | 4 +++- forrustts-genetics/src/lib.rs | 3 +++ forrustts-genetics/tests/test_genetic_maps.rs | 1 + 6 files changed, 13 insertions(+), 7 deletions(-) diff --git a/forrustts-core/Cargo.toml b/forrustts-core/Cargo.toml index 0301a838..ffcccd19 100644 --- a/forrustts-core/Cargo.toml +++ b/forrustts-core/Cargo.toml @@ -13,8 +13,8 @@ keywords = ["simulation", "tree_sequences", "tskit", "population_genetics"] [dependencies] thiserror = "1.0" -# NOTE: automagically adds rand as a cargo feature -rand = { version = "0.8.5", optional = true } +rand = { version = "0.8.5" } +rand_distr = "0.4.3" [dev-dependencies] proptest = "1.1.0" diff --git a/forrustts-core/src/lib.rs b/forrustts-core/src/lib.rs index b6e73a05..2ed22686 100644 --- a/forrustts-core/src/lib.rs +++ b/forrustts-core/src/lib.rs @@ -4,11 +4,13 @@ #![warn(rustdoc::broken_intra_doc_links)] #![cfg_attr(doc_cfg, feature(doc_cfg))] +pub use rand; +pub use rand_distr; + use thiserror::Error; mod position; pub mod prelude; -#[cfg(feature = "rand")] mod rand_position; mod time; diff --git a/forrustts-genetics/Cargo.toml b/forrustts-genetics/Cargo.toml index eae9de75..b1bafd37 100644 --- a/forrustts-genetics/Cargo.toml +++ b/forrustts-genetics/Cargo.toml @@ -12,6 +12,4 @@ keywords = ["simulation", "tree_sequences", "tskit", "population_genetics"] # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -forrustts-core = { version = "0.1.0", path = "../forrustts-core", features = ["rand"]} -rand = "0.8.5" -rand_distr = "0.4.3" +forrustts-core = { version = "0.1.0", path = "../forrustts-core" } diff --git a/forrustts-genetics/src/genetic_maps.rs b/forrustts-genetics/src/genetic_maps.rs index 4b2900b9..9504df54 100644 --- a/forrustts-genetics/src/genetic_maps.rs +++ b/forrustts-genetics/src/genetic_maps.rs @@ -1,5 +1,7 @@ +use crate::rand::Rng; +use crate::rand_distr; + use forrustts_core::Position; -use rand::Rng; /// Breakpoint positions from crossover events /// diff --git a/forrustts-genetics/src/lib.rs b/forrustts-genetics/src/lib.rs index 343244a1..d8ad8c23 100644 --- a/forrustts-genetics/src/lib.rs +++ b/forrustts-genetics/src/lib.rs @@ -1,5 +1,8 @@ //! Core types for genetics +pub use forrustts_core::rand; +pub use forrustts_core::rand_distr; + mod genetic_maps; pub use genetic_maps::BernoulliCrossover; diff --git a/forrustts-genetics/tests/test_genetic_maps.rs b/forrustts-genetics/tests/test_genetic_maps.rs index c0024a58..34f92057 100644 --- a/forrustts-genetics/tests/test_genetic_maps.rs +++ b/forrustts-genetics/tests/test_genetic_maps.rs @@ -1,3 +1,4 @@ +use forrustts_genetics::rand; use rand::SeedableRng; use forrustts_core::Position;