diff --git a/Cargo.toml b/Cargo.toml index 31bcb9e..886b929 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,7 +16,7 @@ tls = ["openssl"] [dependencies] byteorder = "1" url = "^2.1" -rand = "0.8" +rand = "0.9" enum_dispatch = "0.3" openssl = { version = "^0.10", optional = true } r2d2 = "^0.8" diff --git a/tests/tests.rs b/tests/tests.rs index 134ea78..f7d64a9 100644 --- a/tests/tests.rs +++ b/tests/tests.rs @@ -1,19 +1,14 @@ extern crate memcache; extern crate rand; -use rand::distributions::Alphanumeric; -use rand::{Rng, thread_rng}; -use std::iter; +use rand::distr::{Alphanumeric, SampleString}; +use rand::rng; use std::thread; use std::thread::JoinHandle; use std::time; fn gen_random_key() -> String { - let bs = iter::repeat(()) - .map(|()| thread_rng().sample(Alphanumeric)) - .take(10) - .collect::>(); - return String::from_utf8(bs).unwrap(); + Alphanumeric.sample_string(&mut rng(), 10) } #[test]