diff --git a/Cargo.toml b/Cargo.toml index 33e83f24..5394a1c8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,10 +17,12 @@ log = "0.4.5" parking_lot = "0.8.0" rustc-hash = "1.0" smallvec = "0.6.5" +rand = { version = "0.7", features = [ "small_rng" ] } + salsa-macros = { version = "0.13.0", path = "components/salsa-macros" } -rand = "0.6" [dev-dependencies] +rand_distr = "0.2.1" diff = "0.1.0" env_logger = "0.5.13" linked-hash-map = "0.5.2" diff --git a/src/lru/test.rs b/src/lru/test.rs index d77903a5..5d41bd93 100644 --- a/src/lru/test.rs +++ b/src/lru/test.rs @@ -2,7 +2,7 @@ use super::*; use linked_hash_map::LinkedHashMap; -use rand::distributions::{Distribution, Normal}; +use rand_distr::{Distribution, Normal}; #[derive(Debug)] struct TestNode { @@ -56,7 +56,7 @@ fn compare( let mut lru_hits = 0; let mut pick_rng = super::rng_with_seed(PICK_SEED); - let normal = Normal::new((num_nodes / 2) as f64, standard_deviation as f64); + let normal = Normal::new((num_nodes / 2) as f64, standard_deviation as f64).unwrap(); for clock in (0..requests).map(|n| n + 1) { let request_id = (normal.sample(&mut pick_rng) as usize).min(num_nodes - 1); assert!(request_id < num_nodes); diff --git a/tests/parallel/stress.rs b/tests/parallel/stress.rs index 7138a27c..20ec145b 100644 --- a/tests/parallel/stress.rs +++ b/tests/parallel/stress.rs @@ -1,4 +1,6 @@ +use rand::seq::SliceRandom; use rand::Rng; + use salsa::Database; use salsa::ParallelDatabase; use salsa::Snapshot; @@ -82,7 +84,7 @@ enum ReadOp { impl rand::distributions::Distribution for rand::distributions::Standard { fn sample(&self, rng: &mut R) -> Query { - *rng.choose(&[Query::A, Query::B, Query::C]).unwrap() + *[Query::A, Query::B, Query::C].choose(rng).unwrap() } }