From 70e1773edcf5e2bc7369c7afe47bb1348bc2a274 Mon Sep 17 00:00:00 2001 From: drdr xp Date: Mon, 21 Jun 2021 23:12:08 +0800 Subject: [PATCH] dep: adapt to changes of rand-0.8: gen_range() accepts a range instead of two args --- async-raft/src/config.rs | 2 +- async-raft/src/metrics_wait_test.rs | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/async-raft/src/config.rs b/async-raft/src/config.rs index c43d3601d..796492d31 100644 --- a/async-raft/src/config.rs +++ b/async-raft/src/config.rs @@ -127,7 +127,7 @@ impl Config { /// Generate a new random election timeout within the configured min & max. pub fn new_rand_election_timeout(&self) -> u64 { - thread_rng().gen_range(self.election_timeout_min, self.election_timeout_max) + thread_rng().gen_range(self.election_timeout_min..self.election_timeout_max) } } diff --git a/async-raft/src/metrics_wait_test.rs b/async-raft/src/metrics_wait_test.rs index bf127296d..6bacf2511 100644 --- a/async-raft/src/metrics_wait_test.rs +++ b/async-raft/src/metrics_wait_test.rs @@ -145,5 +145,6 @@ fn init_wait_test() -> (RaftMetrics, Wait, watch::Sender) { timeout: Duration::from_millis(100), rx, }; - return (init, w, tx); + + (init, w, tx) }