From 21caf87119d5c015c23ac83a383f9146d34a2a7d Mon Sep 17 00:00:00 2001 From: link2xt Date: Mon, 27 Oct 2025 17:41:39 +0000 Subject: [PATCH] refactor: use SampleString --- src/receive_imf/receive_imf_tests.rs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/receive_imf/receive_imf_tests.rs b/src/receive_imf/receive_imf_tests.rs index ddd36ddc3..fb250533d 100644 --- a/src/receive_imf/receive_imf_tests.rs +++ b/src/receive_imf/receive_imf_tests.rs @@ -1,4 +1,3 @@ -use rand::Rng; use std::time::Duration; use tokio::fs; @@ -20,6 +19,8 @@ use crate::test_utils::{ }; use crate::tools::{SystemTime, time}; +use rand::distr::SampleString; + #[tokio::test(flavor = "multi_thread", worker_threads = 2)] async fn test_outgoing() -> Result<()> { let context = TestContext::new_alice().await; @@ -4339,11 +4340,8 @@ async fn test_download_later() -> Result<()> { let bob_chat = bob.create_chat(&alice).await; // Generate a random string so OpenPGP does not compress it. - let text: String = rand::rng() - .sample_iter(&rand::distr::Alphanumeric) - .take(MIN_DOWNLOAD_LIMIT as usize) - .map(char::from) - .collect(); + let text = + rand::distr::Alphanumeric.sample_string(&mut rand::rng(), MIN_DOWNLOAD_LIMIT as usize); let sent_msg = bob.send_text(bob_chat.id, &text).await; let msg = alice.recv_msg(&sent_msg).await;