Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit02463b1

Browse files
chore: addressed rand 0.9's deprecations
1 parente00ceb1 commit02463b1

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

‎postgres-protocol/src/authentication/sasl.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,10 @@ impl ScramSha256 {
136136
/// Constructs a new instance which will use the provided password for authentication.
137137
pubfnnew(password:&[u8],channel_binding:ChannelBinding) ->ScramSha256{
138138
// rand 0.5's ThreadRng is cryptographically secure
139-
letmut rng = rand::thread_rng();
139+
letmut rng = rand::rng();
140140
let nonce =(0..NONCE_LENGTH)
141141
.map(|_|{
142-
letmut v = rng.gen_range(0x21u8..0x7e);
142+
letmut v = rng.random_range(0x21u8..0x7e);
143143
if v ==0x2c{
144144
v =0x7e
145145
}

‎postgres-protocol/src/password/mod.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const SCRAM_DEFAULT_SALT_LEN: usize = 16;
2828
/// special characters that would require escaping in an SQL command.
2929
pubfnscram_sha_256(password:&[u8]) ->String{
3030
letmut salt:[u8;SCRAM_DEFAULT_SALT_LEN] =[0;SCRAM_DEFAULT_SALT_LEN];
31-
letmut rng = rand::thread_rng();
31+
letmut rng = rand::rng();
3232
rng.fill_bytes(&mut salt);
3333
scram_sha_256_salt(password, salt)
3434
}

‎tokio-postgres/src/connect.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ where
4444

4545
letmut indices =(0..num_hosts).collect::<Vec<_>>();
4646
if config.load_balance_hosts ==LoadBalanceHosts::Random{
47-
indices.shuffle(&mut rand::thread_rng());
47+
indices.shuffle(&mut rand::rng());
4848
}
4949

5050
letmut error =None;
@@ -101,7 +101,7 @@ where
101101
.collect::<Vec<_>>();
102102

103103
if config.load_balance_hosts ==LoadBalanceHosts::Random{
104-
addrs.shuffle(&mut rand::thread_rng());
104+
addrs.shuffle(&mut rand::rng());
105105
}
106106

107107
letmut last_err =None;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp