From 9cc6921dea69a361d48ba1455051f006c5bafabd Mon Sep 17 00:00:00 2001 From: AN Long Date: Sun, 28 Sep 2025 16:54:17 +0900 Subject: [PATCH] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20Upgrade=20rand=20to=200.9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Cargo.toml | 2 +- tests/tests.rs | 11 +++-------- 2 files changed, 4 insertions(+), 9 deletions(-) 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]