Skip to content

Commit b830794

Browse files
authored
Merge pull request #328 from serprex/rand9
rand 0.9
2 parents 3560e37 + ca6e8ea commit b830794

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ lru = "0.14.0"
2424
mysql_common = { version = "0.35", default-features = false }
2525
pem = "3.0"
2626
percent-encoding = "2.1.0"
27-
rand = "0.8.5"
27+
rand = "0.9"
2828
serde = "1"
2929
serde_json = "1"
3030
socket2 = "0.5.2"

src/conn/mod.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1310,7 +1310,7 @@ mod test {
13101310
use bytes::Bytes;
13111311
use futures_util::stream::{self, StreamExt};
13121312
use mysql_common::constants::MAX_PAYLOAD_LEN;
1313-
use rand::Fill;
1313+
use rand::Rng;
13141314
use tokio::{io::AsyncWriteExt, net::TcpListener};
13151315

13161316
use crate::{
@@ -1645,9 +1645,8 @@ mod test {
16451645
];
16461646

16471647
fn random_pass() -> String {
1648-
let mut rng = rand::thread_rng();
1649-
let mut pass = [0u8; 10];
1650-
pass.try_fill(&mut rng).unwrap();
1648+
let mut rng = rand::rng();
1649+
let pass: [u8; 10] = rng.gen();
16511650

16521651
IntoIterator::into_iter(pass)
16531652
.map(|x| ((x % (123 - 97)) + 97) as char)

src/opts/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ impl PoolOpts {
451451
pub(crate) fn new_connection_ttl_deadline(&self) -> Option<Instant> {
452452
if let Some(ttl) = self.abs_conn_ttl {
453453
let jitter = if let Some(jitter) = self.abs_conn_ttl_jitter {
454-
Duration::from_secs(rand::thread_rng().gen_range(0..=jitter.as_secs()))
454+
Duration::from_secs(rand::rng().random_range(0..=jitter.as_secs()))
455455
} else {
456456
Duration::ZERO
457457
};

0 commit comments

Comments
 (0)