Skip to content

Commit d8151ac

Browse files
heftigreivilibre
authored andcommitted
Update rand to 0.9.0
Signed-off-by: Jan Alexander Steffens (heftig) <[email protected]>
1 parent f32a66f commit d8151ac

File tree

4 files changed

+81
-26
lines changed

4 files changed

+81
-26
lines changed

Cargo.lock

Lines changed: 76 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ postgres = "0.19.7"
2121
postgres-openssl = "0.5.0"
2222
pyo3 = { version = "0.22.4", features = ["extension-module"] }
2323
pyo3-log = "0.11.0"
24-
rand = "0.8.5"
24+
rand = "0.9.0"
2525
rayon = "1.7.0"
2626
serial_test = "2.0.0"
2727
state-map = { git = "https://github.com/matrix-org/rust-matrix-state-map", rev = "211343e" }

compressor_integration_tests/src/lib.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use log::LevelFilter;
22
use openssl::ssl::{SslConnector, SslMethod, SslVerifyMode};
33
use postgres::{fallible_iterator::FallibleIterator, Client};
44
use postgres_openssl::MakeTlsConnector;
5-
use rand::{distributions::Alphanumeric, thread_rng, Rng};
5+
use rand::distr::{Alphanumeric, SampleString};
66
use state_map::StateMap;
77
use std::{
88
borrow::Cow,
@@ -102,12 +102,7 @@ impl fmt::Display for PGEscape<'_> {
102102
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
103103
let mut delim = Cow::from("$$");
104104
while self.0.contains(&delim as &str) {
105-
let s: String = thread_rng()
106-
.sample_iter(&Alphanumeric)
107-
.take(10)
108-
.map(char::from)
109-
.collect();
110-
105+
let s = Alphanumeric.sample_string(&mut rand::rng(), 10);
111106
delim = format!("${}$", s).into();
112107
}
113108

src/database.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use log::{debug, trace};
1717
use openssl::ssl::{SslConnector, SslMethod, SslVerifyMode};
1818
use postgres::{fallible_iterator::FallibleIterator, types::ToSql, Client};
1919
use postgres_openssl::MakeTlsConnector;
20-
use rand::{distributions::Alphanumeric, thread_rng, Rng};
20+
use rand::distr::{Alphanumeric, SampleString};
2121
use std::{borrow::Cow, collections::BTreeMap, fmt, time::Duration};
2222

2323
use crate::{compressor::Level, generate_sql};
@@ -470,12 +470,7 @@ impl fmt::Display for PGEscape<'_> {
470470
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
471471
let mut delim = Cow::from("$$");
472472
while self.0.contains(&delim as &str) {
473-
let s: String = thread_rng()
474-
.sample_iter(&Alphanumeric)
475-
.take(10)
476-
.map(char::from)
477-
.collect();
478-
473+
let s = Alphanumeric.sample_string(&mut rand::rng(), 10);
479474
delim = format!("${}$", s).into();
480475
}
481476

0 commit comments

Comments
 (0)