diff --git a/CHANGELOG.md b/CHANGELOG.md index d5a40bbfeb..bfaa6d0325 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## 0.6.20 + + - Migrate to rustls 0.22 + ## 0.6.19 - Added support for user-defined sqlite functions diff --git a/Cargo.lock b/Cargo.lock index 5323ac0f54..0d4506e87b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -246,7 +246,7 @@ dependencies = [ "futures-lite 2.3.0", "parking", "polling 3.6.0", - "rustix 0.38.33", + "rustix 0.38.34", "slab", "tracing", "windows-sys 0.52.0", @@ -297,7 +297,7 @@ dependencies = [ "cfg-if", "event-listener 3.1.0", "futures-lite 1.13.0", - "rustix 0.38.33", + "rustix 0.38.34", "windows-sys 0.48.0", ] @@ -313,7 +313,7 @@ dependencies = [ "cfg-if", "futures-core", "futures-io", - "rustix 0.38.33", + "rustix 0.38.34", "signal-hook-registry", "slab", "windows-sys 0.52.0", @@ -1266,7 +1266,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ef033ed5e9bad94e55838ca0ca906db0e043f517adda0c8b79c7a8c66c93c1b5" dependencies = [ "cfg-if", - "rustix 0.38.33", + "rustix 0.38.34", "windows-sys 0.48.0", ] @@ -1851,9 +1851,9 @@ checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" [[package]] name = "jobserver" -version = "0.1.30" +version = "0.1.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "685a7d121ee3f65ae4fddd72b25a04bb36b6af81bc0828f7d5434c0fe60fa3a2" +checksum = "d2b099aaa34a9751c5bf0878add70444e1ed2dd73f347be99003d4577277de6e" dependencies = [ "libc", ] @@ -2512,7 +2512,7 @@ dependencies = [ "concurrent-queue", "hermit-abi 0.3.9", "pin-project-lite", - "rustix 0.38.33", + "rustix 0.38.34", "tracing", "windows-sys 0.52.0", ] @@ -2933,9 +2933,9 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.33" +version = "0.38.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3cc72858054fcff6d7dea32df2aeaee6a7c24227366d7ea429aada2f26b16ad" +checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" dependencies = [ "bitflags 2.5.0", "errno", @@ -3299,7 +3299,7 @@ dependencies = [ [[package]] name = "sqlx-cli" -version = "0.6.19" +version = "0.6.20" dependencies = [ "anyhow", "async-trait", @@ -3324,7 +3324,7 @@ dependencies = [ [[package]] name = "sqlx-core-oldapi" -version = "0.6.19" +version = "0.6.20" dependencies = [ "ahash 0.8.11", "atoi", @@ -3485,7 +3485,7 @@ dependencies = [ [[package]] name = "sqlx-macros-oldapi" -version = "0.6.19" +version = "0.6.20" dependencies = [ "dotenvy", "either", @@ -3505,7 +3505,7 @@ dependencies = [ [[package]] name = "sqlx-oldapi" -version = "0.6.19" +version = "0.6.20" dependencies = [ "anyhow", "async-std", @@ -3532,7 +3532,7 @@ dependencies = [ [[package]] name = "sqlx-rt-oldapi" -version = "0.6.19" +version = "0.6.20" dependencies = [ "async-native-tls", "async-std", @@ -3679,7 +3679,7 @@ checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1" dependencies = [ "cfg-if", "fastrand 2.0.2", - "rustix 0.38.33", + "rustix 0.38.34", "windows-sys 0.52.0", ] diff --git a/Cargo.toml b/Cargo.toml index 6cabb02b36..78448bcc13 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,7 +20,7 @@ members = [ [package] name = "sqlx-oldapi" -version = "0.6.19" +version = "0.6.20" license = "MIT OR Apache-2.0" readme = "README.md" repository = "https://github.com/lovasoa/sqlx" @@ -125,8 +125,8 @@ bstr = ["sqlx-core/bstr"] git2 = ["sqlx-core/git2"] [dependencies] -sqlx-core = { package = "sqlx-core-oldapi", version = "0.6.19", path = "sqlx-core", default-features = false } -sqlx-macros = { package = "sqlx-macros-oldapi", version = "0.6.19", path = "sqlx-macros", default-features = false, optional = true } +sqlx-core = { package = "sqlx-core-oldapi", version = "0.6.20", path = "sqlx-core", default-features = false } +sqlx-macros = { package = "sqlx-macros-oldapi", version = "0.6.20", path = "sqlx-macros", default-features = false, optional = true } [dev-dependencies] anyhow = "1.0.52" diff --git a/examples/postgres/axum-social-with-tests/Cargo.toml b/examples/postgres/axum-social-with-tests/Cargo.toml index 6703ea0a0c..802ef1943f 100644 --- a/examples/postgres/axum-social-with-tests/Cargo.toml +++ b/examples/postgres/axum-social-with-tests/Cargo.toml @@ -8,7 +8,7 @@ edition = "2021" [dependencies] # Primary crates axum = { version = "0.5.13", features = ["macros"] } -sqlx = { package = "sqlx-oldapi", version = "0.6.19", path = "../../../", features = ["runtime-tokio-rustls", "postgres", "time", "uuid"] } +sqlx = { package = "sqlx-oldapi", version = "0.6.20", path = "../../../", features = ["runtime-tokio-rustls", "postgres", "time", "uuid"] } tokio = { version = "1.20.1", features = ["rt-multi-thread", "macros"] } # Important secondary crates diff --git a/sqlx-cli/Cargo.toml b/sqlx-cli/Cargo.toml index c1f80cfd48..4a81274673 100644 --- a/sqlx-cli/Cargo.toml +++ b/sqlx-cli/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sqlx-cli" -version = "0.6.19" +version = "0.6.20" description = "Command-line utility for SQLx, the Rust SQL toolkit." edition = "2021" readme = "README.md" diff --git a/sqlx-core/Cargo.toml b/sqlx-core/Cargo.toml index 83f28f14fd..25228ab340 100644 --- a/sqlx-core/Cargo.toml +++ b/sqlx-core/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sqlx-core-oldapi" -version = "0.6.19" +version = "0.6.20" repository = "https://github.com/lovasoa/sqlx" description = "Core of SQLx, the rust SQL toolkit. Not intended to be used directly." license = "MIT OR Apache-2.0" @@ -101,7 +101,7 @@ offline = ["serde", "either/serde"] paste = "1.0.6" ahash = "0.8.3" atoi = "2.0.0" -sqlx-rt = { path = "../sqlx-rt", version = "0.6.19", package = "sqlx-rt-oldapi" } +sqlx-rt = { path = "../sqlx-rt", version = "0.6.20", package = "sqlx-rt-oldapi" } base64 = { version = "0.21.2", default-features = false, optional = true, features = ["std"] } bigdecimal_ = { version = "0.4.1", optional = true, package = "bigdecimal" } rust_decimal = { version = "1.19.0", optional = true } diff --git a/sqlx-core/src/io/mod.rs b/sqlx-core/src/io/mod.rs index f994965400..3900d38e0d 100644 --- a/sqlx-core/src/io/mod.rs +++ b/sqlx-core/src/io/mod.rs @@ -1,3 +1,4 @@ +#![allow(unused_imports)] mod buf; mod buf_mut; mod buf_stream; diff --git a/sqlx-core/src/mssql/types/chrono.rs b/sqlx-core/src/mssql/types/chrono.rs index 473596e335..a5326cff0e 100644 --- a/sqlx-core/src/mssql/types/chrono.rs +++ b/sqlx-core/src/mssql/types/chrono.rs @@ -182,7 +182,7 @@ fn decode_time(scale: u8, data: &[u8]) -> error::Result { } fn decode_date(bytes: &[u8]) -> error::Result { - let days_from_ce = LittleEndian::read_i24(&bytes); + let days_from_ce = LittleEndian::read_i24(bytes); chrono::NaiveDate::from_num_days_from_ce_opt(days_from_ce + 1) .ok_or_else(|| err_protocol!("invalid days offset in date: {}", days_from_ce)) } diff --git a/sqlx-core/src/mssql/types/json.rs b/sqlx-core/src/mssql/types/json.rs index 5ac513e2a5..2096758765 100644 --- a/sqlx-core/src/mssql/types/json.rs +++ b/sqlx-core/src/mssql/types/json.rs @@ -33,7 +33,7 @@ where { fn produces(&self) -> Option { let size = 0xFF_FF; - return Some(MssqlTypeInfo(TypeInfo::new(DataType::BigVarBinary, size))); + Some(MssqlTypeInfo(TypeInfo::new(DataType::BigVarBinary, size))) } fn encode_by_ref(&self, buf: &mut Vec) -> IsNull { diff --git a/sqlx-core/src/mssql/types/uint.rs b/sqlx-core/src/mssql/types/uint.rs index a36cae3a6c..20e44f847d 100644 --- a/sqlx-core/src/mssql/types/uint.rs +++ b/sqlx-core/src/mssql/types/uint.rs @@ -25,6 +25,6 @@ impl Encode<'_, Mssql> for u8 { impl Decode<'_, Mssql> for u8 { fn decode(value: MssqlValueRef<'_>) -> Result { - Ok(value.as_bytes()?[0] as u8) + Ok(value.as_bytes()?[0]) } } diff --git a/sqlx-core/src/net/mod.rs b/sqlx-core/src/net/mod.rs index 429c5f6c44..c265c26620 100644 --- a/sqlx-core/src/net/mod.rs +++ b/sqlx-core/src/net/mod.rs @@ -1,8 +1,11 @@ mod socket; mod tls; +#[allow(unused_imports)] pub use socket::Socket; -pub use tls::{CertificateInput, MaybeTlsStream}; +pub use tls::CertificateInput; +#[allow(unused_imports)] +pub use tls::MaybeTlsStream; #[cfg(feature = "_rt-async-std")] type PollReadBuf<'a> = [u8]; diff --git a/sqlx-core/src/net/tls/rustls.rs b/sqlx-core/src/net/tls/rustls.rs index ba7be220e0..154710722a 100644 --- a/sqlx-core/src/net/tls/rustls.rs +++ b/sqlx-core/src/net/tls/rustls.rs @@ -24,7 +24,7 @@ pub async fn configure_tls_connector( .with_custom_certificate_verifier(Arc::new(DummyTlsVerifier)) .with_no_client_auth() } else { - let mut cert_store = rustls::RootCertStore { + let mut cert_store = RootCertStore { roots: webpki_roots::TLS_SERVER_ROOTS.iter().cloned().collect(), }; diff --git a/sqlx-core/src/postgres/message/mod.rs b/sqlx-core/src/postgres/message/mod.rs index 1261bff339..2fb4fa3f44 100644 --- a/sqlx-core/src/postgres/message/mod.rs +++ b/sqlx-core/src/postgres/message/mod.rs @@ -37,6 +37,7 @@ pub use copy::{CopyData, CopyDone, CopyFail, CopyResponse}; pub use data_row::DataRow; pub use describe::Describe; pub use execute::Execute; +#[allow(unused_imports)] pub use flush::Flush; pub use notification::Notification; pub use parameter_description::ParameterDescription; diff --git a/sqlx-core/src/postgres/types/interval.rs b/sqlx-core/src/postgres/types/interval.rs index 39719cab0d..0aeddb3cea 100644 --- a/sqlx-core/src/postgres/types/interval.rs +++ b/sqlx-core/src/postgres/types/interval.rs @@ -171,7 +171,7 @@ impl TryFrom for PgInterval { Ok(Self { months: 0, days: 0, - microseconds: microseconds, + microseconds, }) }, ) diff --git a/sqlx-core/src/sqlite/migrate.rs b/sqlx-core/src/sqlite/migrate.rs index 5ae0e96c58..661d5a1040 100644 --- a/sqlx-core/src/sqlite/migrate.rs +++ b/sqlx-core/src/sqlite/migrate.rs @@ -27,8 +27,7 @@ impl MigrateDatabase for Sqlite { } // Opening a connection to sqlite creates the database - let _ = opts - .connect() + opts.connect() .await? // Ensure WAL mode tempfiles are cleaned up .close() @@ -153,7 +152,7 @@ CREATE TABLE IF NOT EXISTS _sqlx_migrations ( .map_err(MigrateError::AccessMigrationMetadata)?; if let Some(checksum) = checksum { - if checksum == &*migration.checksum { + if checksum == *migration.checksum { Ok(()) } else { Err(MigrateError::VersionMismatch(migration.version)) diff --git a/sqlx-core/src/sqlite/statement/mod.rs b/sqlx-core/src/sqlite/statement/mod.rs index d741dadd6e..5e68eb7b03 100644 --- a/sqlx-core/src/sqlite/statement/mod.rs +++ b/sqlx-core/src/sqlite/statement/mod.rs @@ -57,7 +57,7 @@ impl ColumnIndex> for &'_ str { .column_names .get(*self) .ok_or_else(|| Error::ColumnNotFound((*self).into())) - .map(|v| *v) + .copied() } } diff --git a/sqlx-core/src/sqlite/types/chrono.rs b/sqlx-core/src/sqlite/types/chrono.rs index 0357e7e3f5..373b564070 100644 --- a/sqlx-core/src/sqlite/types/chrono.rs +++ b/sqlx-core/src/sqlite/types/chrono.rs @@ -156,7 +156,7 @@ fn decode_datetime_from_text(value: &str) -> Option> { } fn decode_datetime_from_int(value: i64) -> Option> { - NaiveDateTime::from_timestamp_opt(value, 0).map(|dt| Utc.fix().from_utc_datetime(&dt)) + DateTime::from_timestamp(value, 0).map(|dt| dt.fixed_offset()) } fn decode_datetime_from_float(value: f64) -> Option> { @@ -166,7 +166,7 @@ fn decode_datetime_from_float(value: f64) -> Option> { let seconds = timestamp as i64; let nanos = (timestamp.fract() * 1E9) as u32; - NaiveDateTime::from_timestamp_opt(seconds, nanos).map(|dt| Utc.fix().from_utc_datetime(&dt)) + DateTime::from_timestamp(seconds, nanos).map(|dt| dt.fixed_offset()) } impl<'r> Decode<'r, Sqlite> for NaiveDateTime { diff --git a/sqlx-core/src/sqlite/types/json.rs b/sqlx-core/src/sqlite/types/json.rs index 8f6bf6dc88..c09fe8a3cb 100644 --- a/sqlx-core/src/sqlite/types/json.rs +++ b/sqlx-core/src/sqlite/types/json.rs @@ -37,7 +37,7 @@ where fn decode(value: SqliteValueRef<'r>) -> Result { let string_value = <&str as Decode>::decode(value)?; - serde_json::from_str(&string_value) + serde_json::from_str(string_value) .map(Json) .map_err(Into::into) } diff --git a/sqlx-macros/Cargo.toml b/sqlx-macros/Cargo.toml index 5f1a942ad3..17293bf91d 100644 --- a/sqlx-macros/Cargo.toml +++ b/sqlx-macros/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sqlx-macros-oldapi" -version = "0.6.19" +version = "0.6.20" repository = "https://github.com/lovasoa/sqlx" description = "Macros for SQLx, the rust SQL toolkit. Not intended to be used directly." license = "MIT OR Apache-2.0" @@ -75,8 +75,8 @@ heck = { version = "0.4", features = ["unicode"] } either = "1.6.1" once_cell = "1.9.0" proc-macro2 = { version = "1.0.36", default-features = false } -sqlx-core = { package = "sqlx-core-oldapi", version = "0.6.19", default-features = false, features = ["any"], path = "../sqlx-core" } -sqlx-rt = { version = "0.6.19", default-features = false, path = "../sqlx-rt", package = "sqlx-rt-oldapi" } +sqlx-core = { package = "sqlx-core-oldapi", version = "0.6.20", default-features = false, features = ["any"], path = "../sqlx-core" } +sqlx-rt = { version = "0.6.20", default-features = false, path = "../sqlx-rt", package = "sqlx-rt-oldapi" } serde = { version = "1.0.132", features = ["derive"], optional = true } serde_json = { version = "1.0.73", optional = true } sha2 = { version = "0.10.0", optional = true } diff --git a/sqlx-rt/Cargo.toml b/sqlx-rt/Cargo.toml index f1dbfa1bac..d6641e6216 100644 --- a/sqlx-rt/Cargo.toml +++ b/sqlx-rt/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sqlx-rt-oldapi" -version = "0.6.19" +version = "0.6.20" repository = "https://github.com/launchbadge/sqlx" license = "MIT OR Apache-2.0" description = "Runtime abstraction used by SQLx, the Rust SQL toolkit. Not intended to be used directly." diff --git a/tests/mssql/types.rs b/tests/mssql/types.rs index 86a1179fdf..309601e839 100644 --- a/tests/mssql/types.rs +++ b/tests/mssql/types.rs @@ -55,9 +55,9 @@ test_type!(numeric(Mssql, "CAST(12 AS NUMERIC)" == 12_f64, "CAST(939399419.1225182 AS NUMERIC(15,2))" == 939399419.12_f64, "CAST(939399419.1225182 AS DECIMAL(15,2))" == 939399419.12_f64, - "CAST(123456789.0123456789 AS NUMERIC(38,10))" == 123456789.0123456789_f64, - "CAST(123456789.0123456789012 AS NUMERIC(38,13))" == 123456789.0123456789012_f64, - "CAST(123456789.012345678901234 AS NUMERIC(38,15))" == 123456789.012345678901234_f64, + "CAST(123456789.0123456789 AS NUMERIC(38,10))" == 123_456_789.012_345_67_f64, + "CAST(123456789.0123456789012 AS NUMERIC(38,13))" == 123_456_789.012_345_67_f64, + "CAST(123456789.012345678901234 AS NUMERIC(38,15))" == 123_456_789.012_345_67_f64, )); test_type!(str_nvarchar(Mssql, diff --git a/tests/mysql/describe.rs b/tests/mysql/describe.rs index 43f6e3e320..24788a2954 100644 --- a/tests/mysql/describe.rs +++ b/tests/mysql/describe.rs @@ -51,8 +51,8 @@ CREATE TEMPORARY TABLE with_bit_and_tinyint ( assert_eq!(d.column(1).name(), "value_bit_1"); assert_eq!(d.column(1).type_info().name(), "BIT"); - assert!(>::compatible(&d.column(1).type_info())); - assert!(>::compatible(&d.column(2).type_info())); + assert!(>::compatible(d.column(1).type_info())); + assert!(>::compatible(d.column(2).type_info())); Ok(()) } diff --git a/tests/mysql/test-attr.rs b/tests/mysql/test-attr.rs index 248bea38ed..d49a11700b 100644 --- a/tests/mysql/test-attr.rs +++ b/tests/mysql/test-attr.rs @@ -76,7 +76,7 @@ async fn it_gets_comments(pool: MySqlPool) -> sqlx_oldapi::Result<()> { let post_1_comments: Vec = sqlx_oldapi::query_scalar( "SELECT content FROM comment WHERE post_id = ? ORDER BY created_at", ) - .bind(&1) + .bind(1) .fetch_all(&pool) .await?; @@ -88,7 +88,7 @@ async fn it_gets_comments(pool: MySqlPool) -> sqlx_oldapi::Result<()> { let post_2_comments: Vec = sqlx_oldapi::query_scalar( "SELECT content FROM comment WHERE post_id = ? ORDER BY created_at", ) - .bind(&2) + .bind(2) .fetch_all(&pool) .await?; diff --git a/tests/mysql/types.rs b/tests/mysql/types.rs index 2ccea0661b..55167bd3c4 100644 --- a/tests/mysql/types.rs +++ b/tests/mysql/types.rs @@ -305,8 +305,8 @@ CREATE TEMPORARY TABLE with_bits ( .await?; sqlx_oldapi::query("INSERT INTO with_bits (value_1, value_n) VALUES (?, ?)") - .bind(&1_u8) - .bind(&510202_u32) + .bind(1_u8) + .bind(510202_u32) .execute(&mut conn) .await?; diff --git a/tests/postgres/test-attr.rs b/tests/postgres/test-attr.rs index 50e2c3abfc..5e01cd152b 100644 --- a/tests/postgres/test-attr.rs +++ b/tests/postgres/test-attr.rs @@ -72,7 +72,7 @@ async fn it_gets_comments(pool: PgPool) -> sqlx_oldapi::Result<()> { let post_1_comments: Vec = sqlx_oldapi::query_scalar( "SELECT content FROM comment WHERE post_id = $1::uuid ORDER BY created_at", ) - .bind(&"252c1d98-a9b0-4f18-8298-e59058bdfe16") + .bind("252c1d98-a9b0-4f18-8298-e59058bdfe16") .fetch_all(&pool) .await?; @@ -84,7 +84,7 @@ async fn it_gets_comments(pool: PgPool) -> sqlx_oldapi::Result<()> { let post_2_comments: Vec = sqlx_oldapi::query_scalar( "SELECT content FROM comment WHERE post_id = $1::uuid ORDER BY created_at", ) - .bind(&"844265f7-2472-4689-9a2e-b21f40dbf401") + .bind("844265f7-2472-4689-9a2e-b21f40dbf401") .fetch_all(&pool) .await?; diff --git a/tests/postgres/types.rs b/tests/postgres/types.rs index cb219c50b4..9fb7d80082 100644 --- a/tests/postgres/types.rs +++ b/tests/postgres/types.rs @@ -134,7 +134,7 @@ test_type!(f64_numeric( "12::numeric" == 12_f64, "939399419.1225182::numeric(15,2)" == 939399419.12_f64, "939399419.1225182::decimal(15,2)" == 939399419.12_f64, - "0.0000011355377864674665033817291259765625::numeric" == 0.0000011355377864674665033817291259765625f64 + "0.0000011355377864674665033817291259765625::numeric" == 0.000_001_135_537_786_467_466_5_f64 )); test_type!(f64_vec>(Postgres, diff --git a/tests/sqlite/types.rs b/tests/sqlite/types.rs index 05a65a4702..e490e061dc 100644 --- a/tests/sqlite/types.rs +++ b/tests/sqlite/types.rs @@ -1,3 +1,4 @@ +#![allow(clippy::approx_constant)] extern crate time_ as time; use sqlx_core::row::Row;