From b9e71ec340400d515e8f46df4c7afab7700e9cdb Mon Sep 17 00:00:00 2001 From: Thomas Tanon Date: Wed, 25 Nov 2026 14:56:07 +0100 Subject: [PATCH 1/9] fix(clippy): adjust float round-trip test values --- src/types/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/types/mod.rs b/src/types/mod.rs index 35e84f50..371bbeac 100644 --- a/src/types/mod.rs +++ b/src/types/mod.rs @@ -134,11 +134,11 @@ mod roundtrip_tests { fn test_roundtrip_floats() { test_roundtrip_float!(f32, 0.0, &Type::FLOAT4); test_roundtrip_float!(f32, 1.5, &Type::FLOAT4); - test_roundtrip_float!(f32, -3.14, &Type::FLOAT4); + test_roundtrip_float!(f32, -3.15, &Type::FLOAT4); test_roundtrip_float!(f64, 0.0, &Type::FLOAT8); test_roundtrip_float!(f64, 1.5, &Type::FLOAT8); - test_roundtrip_float!(f64, -3.14159265359, &Type::FLOAT8); + test_roundtrip_float!(f64, -3.15159265359, &Type::FLOAT8); } #[test] From 40eb45c5a01d22f96ce750da85bb8b1dc6b5d8e2 Mon Sep 17 00:00:00 2001 From: Thomas Tanon Date: Wed, 25 Nov 2026 14:56:07 +0100 Subject: [PATCH 2/9] fix(clippy): use byte strings for message tags --- tests/short_message_length_test.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/short_message_length_test.rs b/tests/short_message_length_test.rs index b994197a..c2dc86a6 100644 --- a/tests/short_message_length_test.rs +++ b/tests/short_message_length_test.rs @@ -42,7 +42,7 @@ fn other_frontend_and_backend_messages_reject_short_lengths() { ctx.awaiting_frontend_startup = false; for length in [0, 1, 2, 3] { - for message_type in [b'B', b'P', b'Q', b'd'] { + for &message_type in b"BPQd" { let mut packet = BytesMut::new(); packet.put_u8(message_type); packet.put_i32(length); @@ -51,7 +51,7 @@ fn other_frontend_and_backend_messages_reject_short_lengths() { Err(PgWireError::InvalidMessageLength(actual)) if actual == length as usize )); } - for message_type in [b'D', b'G', b'R'] { + for &message_type in b"DGR" { let mut packet = BytesMut::new(); packet.put_u8(message_type); packet.put_i32(length); From f5f9c037bb701c4cd800aeca807cccee01dc9912 Mon Sep 17 00:00:00 2001 From: Thomas Tanon Date: Wed, 25 Nov 2026 14:56:07 +0100 Subject: [PATCH 3/9] fix(clippy): remove redundant formatting borrow --- examples/bench.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/bench.rs b/examples/bench.rs index b05ce55b..d2c9b737 100644 --- a/examples/bench.rs +++ b/examples/bench.rs @@ -77,7 +77,7 @@ pub async fn main() { let server_addr = std::env::var("PGWIRE_BENCH_ADDR").unwrap_or(String::from("127.0.0.1:5433")); let listener = TcpListener::bind(&server_addr).await.unwrap(); - println!("Listening to {}", &server_addr); + println!("Listening to {}", server_addr); loop { let incoming_socket = listener.accept().await.unwrap(); let factory_ref = factory.clone(); From 7a8592c3563961566d70adc245040a2df9403a47 Mon Sep 17 00:00:00 2001 From: Thomas Tanon Date: Wed, 25 Nov 2026 14:56:07 +0100 Subject: [PATCH 4/9] fix(clippy): use is_err for timestamp parsing fallback --- tests-integration/test-server/src/main.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests-integration/test-server/src/main.rs b/tests-integration/test-server/src/main.rs index f77f4b81..06bb95f9 100644 --- a/tests-integration/test-server/src/main.rs +++ b/tests-integration/test-server/src/main.rs @@ -237,7 +237,10 @@ impl ExtendedQueryHandler for DummyDatabase { // JDBC doesn't provide type information for some cases, // we try to parse them as TIMESTAMP or DATE accordingly - if let Err(_) = portal.parameter::(idx, &Type::TIMESTAMP) { + if portal + .parameter::(idx, &Type::TIMESTAMP) + .is_err() + { let _ = portal.parameter::(idx, &Type::DATE); } } From 386f42776f8b43ef83ce5a2be52abdf9dc9c2852 Mon Sep 17 00:00:00 2001 From: Thomas Tanon Date: Wed, 25 Nov 2026 14:56:07 +0100 Subject: [PATCH 5/9] fix(clippy): use expect_err in client integration tests --- tests-integration/client-api/tests/cancel.rs | 2 +- tests-integration/client-api/tests/extended_query.rs | 3 +-- tests-integration/client-api/tests/simple_query.rs | 3 +-- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/tests-integration/client-api/tests/cancel.rs b/tests-integration/client-api/tests/cancel.rs index aa84354e..5d959610 100644 --- a/tests-integration/client-api/tests/cancel.rs +++ b/tests-integration/client-api/tests/cancel.rs @@ -125,7 +125,7 @@ async fn cancel_request_message_cancels_from_another_connection() { send_cancel_request(pid, secret_key).await; let result = query.await.expect("query task panicked"); - match result.err().expect("query should have been cancelled") { + match result.expect_err("query should have been cancelled") { pgwire::error::PgWireClientError::RemoteError(info) => { assert_eq!(info.code, QUERY_CANCELED); } diff --git a/tests-integration/client-api/tests/extended_query.rs b/tests-integration/client-api/tests/extended_query.rs index aae90d74..47773c18 100644 --- a/tests-integration/client-api/tests/extended_query.rs +++ b/tests-integration/client-api/tests/extended_query.rs @@ -327,8 +327,7 @@ async fn server_error_is_reported_and_connection_recovers() { let error = eqc .prepare(Some("st_broken"), "SELEC 1", &[]) .await - .err() - .expect("preparing a syntax error must fail"); + .expect_err("preparing a syntax error must fail"); match error { PgWireClientError::RemoteError(info) => { diff --git a/tests-integration/client-api/tests/simple_query.rs b/tests-integration/client-api/tests/simple_query.rs index 878eecbb..e2623b13 100644 --- a/tests-integration/client-api/tests/simple_query.rs +++ b/tests-integration/client-api/tests/simple_query.rs @@ -152,8 +152,7 @@ async fn server_error_is_reported_and_connection_recovers() { "SELECT * FROM pgwire_itest_no_such_table", ) .await - .err() - .expect("querying a missing table must fail"); + .expect_err("querying a missing table must fail"); match error { PgWireClientError::RemoteError(info) => { From 0221c8d08b2d32f024b99ce83d16142c5dba6f04 Mon Sep 17 00:00:00 2001 From: Thomas Tanon Date: Wed, 25 Nov 2026 14:56:44 +0100 Subject: [PATCH 6/9] fix(clippy): initialize format options directly --- src/types/format/date_style.rs | 42 ++++++++++++++++++++---------- src/types/format/interval_style.rs | 6 +++-- src/types/mod.rs | 30 ++++++++++++++------- 3 files changed, 52 insertions(+), 26 deletions(-) diff --git a/src/types/format/date_style.rs b/src/types/format/date_style.rs index 9738de1f..9d0c1feb 100644 --- a/src/types/format/date_style.rs +++ b/src/types/format/date_style.rs @@ -297,8 +297,10 @@ mod tests { let datetime: DateTime = Utc.from_utc_datetime(&dt); let mut out = BytesMut::new(); - let mut format_option = FormatOptions::default(); - format_option.date_style = "ISO".to_string(); + let format_option = FormatOptions { + date_style: "ISO".to_string(), + ..Default::default() + }; datetime .to_sql_text(&Type::TIMESTAMP, &mut out, &format_option) @@ -347,8 +349,10 @@ mod tests { .unwrap(); let mut out = BytesMut::new(); - let mut format_options = FormatOptions::default(); - format_options.date_style = "SQL, DMY".to_string(); + let format_options = FormatOptions { + date_style: "SQL, DMY".to_string(), + ..Default::default() + }; dt.to_sql_text(&Type::TIMESTAMP, &mut out, &format_options) .unwrap(); @@ -387,8 +391,10 @@ mod tests { let system_time = UNIX_EPOCH + Duration::from_secs(1703514645); // 2023-12-25 14:30:45 UTC let mut out = BytesMut::new(); - let mut format_options = FormatOptions::default(); - format_options.date_style = "german".to_string(); + let format_options = FormatOptions { + date_style: "german".to_string(), + ..Default::default() + }; system_time .to_sql_text(&Type::TIMESTAMP, &mut out, &format_options) @@ -406,8 +412,10 @@ mod tests { let date = NaiveDate::from_ymd_opt(2023, 12, 25).unwrap(); let mut out = BytesMut::new(); - let mut format_options = FormatOptions::default(); - format_options.date_style = "postgres, DMY".to_string(); + let format_options = FormatOptions { + date_style: "postgres, DMY".to_string(), + ..Default::default() + }; date.to_sql_text(&Type::DATE, &mut out, &format_options) .unwrap(); @@ -424,8 +432,10 @@ mod tests { .and_hms_opt(14, 30, 45) .unwrap(); let mut out = BytesMut::new(); - let mut format_options = FormatOptions::default(); - format_options.date_style = "ISO".to_string(); + let format_options = FormatOptions { + date_style: "ISO".to_string(), + ..Default::default() + }; let result = dt.to_sql_text(&Type::BOOL, &mut out, &format_options); assert!(result.is_err()); @@ -441,8 +451,10 @@ mod tests { .and_hms_micro_opt(14, 30, 45, 123456) .unwrap(); let mut out = BytesMut::new(); - let mut format_options = FormatOptions::default(); - format_options.date_style = "postgres".to_string(); + let format_options = FormatOptions { + date_style: "postgres".to_string(), + ..Default::default() + }; dt.to_sql_text(&Type::TIMESTAMP, &mut out, &format_options) .unwrap(); @@ -460,8 +472,10 @@ mod tests { .and_hms_micro_opt(7, 37, 16, 123000) .unwrap(); let mut out = BytesMut::new(); - let mut format_options = FormatOptions::default(); - format_options.date_style = "postgres, DMY".to_string(); + let format_options = FormatOptions { + date_style: "postgres, DMY".to_string(), + ..Default::default() + }; dt.to_sql_text(&Type::TIMESTAMP, &mut out, &format_options) .unwrap(); diff --git a/src/types/format/interval_style.rs b/src/types/format/interval_style.rs index a52d1839..4d739fc2 100644 --- a/src/types/format/interval_style.rs +++ b/src/types/format/interval_style.rs @@ -181,8 +181,10 @@ mod tests { let duration = Duration::seconds(86400 + 7200 + 120 + 2); // 1 day, 2 hours, 2 minutes, 2 seconds let mut out = BytesMut::new(); - let mut format_options = FormatOptions::default(); - format_options.interval_style = "postgres_verbose".to_string(); + let format_options = FormatOptions { + interval_style: "postgres_verbose".to_string(), + ..Default::default() + }; duration .to_sql_text(&Type::INTERVAL, &mut out, &format_options) diff --git a/src/types/mod.rs b/src/types/mod.rs index 371bbeac..4461bd49 100644 --- a/src/types/mod.rs +++ b/src/types/mod.rs @@ -526,8 +526,10 @@ mod roundtrip_tests { fn test_roundtrip_interval_iso8601_style() { use pg_interval::Interval; - let mut format_options = FormatOptions::default(); - format_options.interval_style = "iso_8601".to_string(); + let format_options = FormatOptions { + interval_style: "iso_8601".to_string(), + ..Default::default() + }; // Test simple time interval let interval1 = Interval::new(0, 0, 3661000000i64); @@ -589,8 +591,10 @@ mod roundtrip_tests { fn test_roundtrip_interval_postgres_verbose_style() { use pg_interval::Interval; - let mut format_options = FormatOptions::default(); - format_options.interval_style = "postgres_verbose".to_string(); + let format_options = FormatOptions { + interval_style: "postgres_verbose".to_string(), + ..Default::default() + }; // Test interval with months let interval1 = Interval::new(6, 0, 0); @@ -710,8 +714,10 @@ mod roundtrip_tests { fn test_roundtrip_interval_negative_values_iso8601() { use pg_interval::Interval; - let mut format_options = FormatOptions::default(); - format_options.interval_style = "iso_8601".to_string(); + let format_options = FormatOptions { + interval_style: "iso_8601".to_string(), + ..Default::default() + }; let interval1 = Interval::new(-6, 0, 0); let mut buf = BytesMut::new(); @@ -738,8 +744,10 @@ mod roundtrip_tests { fn test_roundtrip_interval_negative_values_postgres_verbose() { use pg_interval::Interval; - let mut format_options = FormatOptions::default(); - format_options.interval_style = "postgres_verbose".to_string(); + let format_options = FormatOptions { + interval_style: "postgres_verbose".to_string(), + ..Default::default() + }; let interval1 = Interval::new(-6, 0, 0); let mut buf = BytesMut::new(); @@ -768,10 +776,12 @@ mod roundtrip_tests { let interval = Interval::new(12, 15, 1296060000000i64); - let mut format_options = FormatOptions::default(); + let mut format_options = FormatOptions { + interval_style: "postgres".to_string(), + ..Default::default() + }; // Test postgres encoding - format_options.interval_style = "postgres".to_string(); let mut buf = BytesMut::new(); interval .to_sql_text(&Type::INTERVAL, &mut buf, &format_options) From 1afbdc0d6b64c7f500a34302cb02009960497fa1 Mon Sep 17 00:00:00 2001 From: Thomas Tanon Date: Wed, 25 Nov 2026 14:56:44 +0100 Subject: [PATCH 7/9] fix(clippy): scope the extended query borrow --- tests-integration/client-api/tests/extended_query.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/tests-integration/client-api/tests/extended_query.rs b/tests-integration/client-api/tests/extended_query.rs index 47773c18..3bf210f0 100644 --- a/tests-integration/client-api/tests/extended_query.rs +++ b/tests-integration/client-api/tests/extended_query.rs @@ -357,7 +357,6 @@ async fn parameter_status_during_extended_query_updates_cache() { .await .expect("SET via extended query failed"); - drop(eqc); assert_eq!( client.server_parameters().get("application_name"), Some(&"eq-renamed".to_owned()) From 4a39ed2e760694d7bb8bf4c43e1a5a3a7a56b08d Mon Sep 17 00:00:00 2001 From: Thomas Tanon Date: Wed, 25 Nov 2026 15:49:03 +0100 Subject: [PATCH 8/9] ci: Run clippy against all targets --- .github/workflows/ci.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e41a66dc..174eb11a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,15 +30,15 @@ jobs: components: clippy override: true - name: Lint default - run: cargo clippy --features pg-type-postgis -- -D warnings + run: cargo clippy --all-targets --features pg-type-postgis -- -D warnings - name: Lint minimal - run: cargo clippy --no-default-features -- -D warnings + run: cargo clippy --all-targets --no-default-features -- -D warnings - name: Lint server-api without tls - run: cargo clippy --no-default-features --features server-api -- -D warnings + run: cargo clippy --all-targets --no-default-features --features server-api -- -D warnings - name: Lint ring - run: cargo clippy --no-default-features --features server-api-ring -- -D warnings + run: cargo clippy --all-targets --no-default-features --features server-api-ring -- -D warnings - name: Lint client api - run: cargo clippy --features client-api-aws-lc-rs -- -D warnings + run: cargo clippy --all-targets --features client-api-aws-lc-rs -- -D warnings test: name: Test From 5a13439a9f80d2f350c4778f9e472e0f895e75d6 Mon Sep 17 00:00:00 2001 From: Thomas Tanon Date: Wed, 25 Nov 2026 15:52:05 +0100 Subject: [PATCH 9/9] fix(clippy): gate chrono test macros on pg-type-chrono --- src/types/from_sql_text.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/types/from_sql_text.rs b/src/types/from_sql_text.rs index f99ffab9..004c4e95 100644 --- a/src/types/from_sql_text.rs +++ b/src/types/from_sql_text.rs @@ -586,6 +586,7 @@ mod tests { #[cfg(feature = "pg-type-chrono")] use chrono::TimeZone; + #[cfg(feature = "pg-type-chrono")] macro_rules! test_parse_naive_date { ($sql_text:expr, $expected:expr) => { let result = @@ -595,6 +596,7 @@ mod tests { }; } + #[cfg(feature = "pg-type-chrono")] macro_rules! test_parse_naive_datetime { ($sql_text:expr, $expected:expr) => { let result = NaiveDateTime::from_sql_text( @@ -607,6 +609,7 @@ mod tests { }; } + #[cfg(feature = "pg-type-chrono")] macro_rules! test_parse_datetime_fixed_offset { ($sql_text:expr, $expected:expr) => { let result = DateTime::::from_sql_text(