Skip to content

Commit 5f0b1fc

Browse files
committed
downgrade rand
1 parent 241a890 commit 5f0b1fc

File tree

18 files changed

+30
-74
lines changed

18 files changed

+30
-74
lines changed

Cargo.lock

+6-50
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ paste = "1.0.6"
143143
serde = { version = "1.0.132", features = ["derive"] }
144144
serde_json = "1.0.73"
145145
url = "2.2.2"
146-
rand = "0.9"
146+
rand = "0.8"
147147
rand_xoshiro = "0.7.0"
148148
hex = "0.4.3"
149149
tempdir = "0.3.7"

examples/postgres/axum-social-with-tests/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ tokio = { version = "1.20.1", features = ["rt-multi-thread", "macros"] }
1313

1414
# Important secondary crates
1515
argon2 = "0.4.1"
16-
rand = "0.8.5"
16+
rand = "0.8"
1717
regex = "1.6.0"
1818
serde = "1.0.140"
1919
serde_with = { version = "2.0.0", features = ["time_0_3"] }

sqlx-core/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ memchr = { version = "2.4.1", default-features = false }
141141
num-bigint = { version = "0.4.0", default-features = false, optional = true, features = ["std"] }
142142
once_cell = "1.9.0"
143143
percent-encoding = "2.1.0"
144-
rand = { version = "0.9", default-features = false, optional = true, features = ["std", "std_rng"] }
144+
rand = { version = "0.8", default-features = false, optional = true, features = ["std", "std_rng"] }
145145
regex = { version = "1.5.5", optional = true }
146146
rsa = { version = "0.9.2", optional = true }
147147
rustls = { version = "0.22.4", optional = true }

sqlx-core/src/lib.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
#![warn(future_incompatible, rust_2018_idioms)]
55
#![allow(clippy::needless_doctest_main, clippy::type_complexity, dead_code)]
66
#![deny(
7-
cast_possible_truncation,
8-
cast_possible_wrap,
9-
cast_precision_loss,
10-
cast_sign_loss
7+
clippy::cast_possible_truncation,
8+
clippy::cast_possible_wrap,
9+
clippy::cast_precision_loss,
10+
clippy::cast_sign_loss
1111
)]
1212
// See `clippy.toml` at the workspace root
1313
#![deny(clippy::disallowed_methods)]

sqlx-core/src/mssql/connection/mod.rs

-2
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ impl Debug for MssqlConnection {
2929
}
3030
}
3131

32-
use std::ops::DerefMut;
33-
3432
impl Connection for MssqlConnection {
3533
type Database = Mssql;
3634

sqlx-core/src/mssql/connection/tls_prelogin_stream_wrapper.rs

-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ use sqlx_rt::{AsyncRead, AsyncWrite};
1111
#[cfg(feature = "_rt-tokio")]
1212
use sqlx_rt::ReadBuf;
1313

14-
use std::cmp;
1514
use std::io;
1615
use std::pin::Pin;
1716
use std::task::{self, ready, Poll};

sqlx-core/src/mssql/protocol/pre_login.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
use std::default;
21
use std::fmt::{self, Display, Formatter};
32

43
use bytes::{Buf, Bytes};

sqlx-core/src/mssql/types/int.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
use byteorder::{ByteOrder, LittleEndian};
21
use std::any::type_name;
2+
use std::convert::TryFrom;
3+
use std::i16;
34

45
use crate::decode::Decode;
56
use crate::encode::{Encode, IsNull};
@@ -141,7 +142,7 @@ impl Decode<'_, Mssql> for i64 {
141142
.into());
142143
}
143144

144-
buf[..len].copy_from_slice(&bytes_val);
145+
buf[..len].copy_from_slice(bytes_val);
145146
Ok(i64::from_le_bytes(buf))
146147
}
147148
DataType::Numeric | DataType::NumericN | DataType::Decimal | DataType::DecimalN => {

sqlx-core/src/mssql/types/json.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ impl<T> Type<Mssql> for Json<T> {
2727
}
2828
}
2929

30-
impl<'q, T> Encode<'q, Mssql> for Json<T>
30+
impl<T> Encode<'_, Mssql> for Json<T>
3131
where
3232
T: Serialize,
3333
{

sqlx-core/src/mssql/types/uint.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ impl Decode<'_, Mssql> for u8 {
2626
fn decode(value: MssqlValueRef<'_>) -> Result<Self, BoxDynError> {
2727
Ok(*value
2828
.as_bytes()?
29-
.get(0)
29+
.first()
3030
.ok_or("Invalid numeric value length")?)
3131
}
3232
}

sqlx-core/src/mysql/connection/auth.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ async fn encrypt_rsa<'s>(
149149
// client sends an RSA encrypted password
150150
let pkey = parse_rsa_pub_key(rsa_pub_key)?;
151151
let padding = Oaep::new::<sha1::Sha1>();
152-
pkey.encrypt(&mut rand::rng(), padding, &pass[..])
152+
pkey.encrypt(&mut rand::thread_rng(), padding, &pass[..])
153153
.map_err(Error::protocol)
154154
}
155155

sqlx-core/src/postgres/connection/establish.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
use rand::Rng as _;
2+
13
use crate::HashMap;
24

35
use crate::common::StatementCache;
@@ -144,7 +146,7 @@ impl PgConnection {
144146
transaction_status,
145147
transaction_depth: 0,
146148
pending_ready_for_query_count: 0,
147-
next_statement_id: Oid(rand::rng().gen_range(0..u32::MAX)),
149+
next_statement_id: Oid(rand::thread_rng().gen()),
148150
cache_statement: StatementCache::new(options.statement_cache_capacity),
149151
cache_type_oid: HashMap::new(),
150152
cache_type_info: HashMap::new(),

sqlx-core/src/postgres/connection/sasl.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ pub(crate) async fn authenticate(
174174

175175
// nonce is a sequence of random printable bytes
176176
fn gen_nonce() -> String {
177-
let mut rng = rand::rng();
177+
let mut rng = rand::thread_rng();
178178
let count = rng.gen_range(64..128);
179179

180180
// printable = %x21-2B / %x2D-7E

sqlx-core/src/query.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ where
396396
// Make a SQL query from a statement.
397397
pub(crate) fn query_statement<'q, DB>(
398398
statement: &'q <DB as HasStatement<'q>>::Statement,
399-
) -> Query<'q, DB, <DB as HasArguments<'_>>::Arguments>
399+
) -> Query<'q, DB, <DB as HasArguments<'q>>::Arguments>
400400
where
401401
DB: Database,
402402
{

sqlx-core/src/query_as.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ pub struct QueryAs<'q, DB: Database, O, A> {
2121
pub(crate) output: PhantomData<O>,
2222
}
2323

24-
impl<'q, DB, O: Send, A: Send> Execute<'q, DB> for QueryAs<'q, DB, O, A>
24+
impl<'q, DB: Database, O: Send, A: Send> Execute<'q, DB> for QueryAs<'q, DB, O, A>
2525
where
2626
DB: Database,
2727
A: 'q + IntoArguments<'q, DB>,
@@ -197,7 +197,7 @@ where
197197
// Make a SQL query from a statement, that is mapped to a concrete type.
198198
pub(crate) fn query_statement_as<'q, DB, O>(
199199
statement: &'q <DB as HasStatement<'q>>::Statement,
200-
) -> QueryAs<'q, DB, O, <DB as HasArguments<'_>>::Arguments>
200+
) -> QueryAs<'q, DB, O, <DB as HasArguments<'q>>::Arguments>
201201
where
202202
DB: Database,
203203
O: for<'r> FromRow<'r, DB::Row>,

sqlx-core/src/query_scalar.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ where
190190
// Make a SQL query from a statement, that is mapped to a concrete value.
191191
pub(crate) fn query_statement_scalar<'q, DB, O>(
192192
statement: &'q <DB as HasStatement<'q>>::Statement,
193-
) -> QueryScalar<'q, DB, O, <DB as HasArguments<'_>>::Arguments>
193+
) -> QueryScalar<'q, DB, O, <DB as HasArguments<'q>>::Arguments>
194194
where
195195
DB: Database,
196196
(O,): for<'r> FromRow<'r, DB::Row>,

sqlx-rt/Cargo.toml

+3-2
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,22 @@ authors = [
1111
]
1212

1313
[features]
14-
runtime-actix-native-tls = ["runtime-tokio-native-tls"]
14+
runtime-actix-native-tls = ["_rt-actix", "_tls-native-tls", "tokio-native-tls"]
1515
runtime-async-std-native-tls = [
1616
"_rt-async-std",
1717
"_tls-native-tls",
1818
"async-native-tls",
1919
]
2020
runtime-tokio-native-tls = ["_rt-tokio", "_tls-native-tls", "tokio-native-tls"]
2121

22-
runtime-actix-rustls = ["runtime-tokio-rustls"]
22+
runtime-actix-rustls = ["_rt-actix", "_tls-rustls", "tokio-rustls"]
2323
runtime-async-std-rustls = ["_rt-async-std", "_tls-rustls", "futures-rustls"]
2424
runtime-tokio-rustls = ["_rt-tokio", "_tls-rustls", "tokio-rustls"]
2525

2626
# Not used directly and not re-exported from sqlx
2727
_rt-async-std = ["async-std"]
2828
_rt-tokio = ["tokio", "once_cell"]
29+
_rt-actix = ["_rt-tokio"]
2930
_tls-native-tls = ["native-tls"]
3031
_tls-rustls = []
3132

0 commit comments

Comments
 (0)