Skip to content

Commit 4893583

Browse files
committed
fix: update lint configurations and suppress unused import warnings in tests
- Added 'cfg(postgres_9_6)' to the lint configuration in Cargo.toml. - Suppressed unused import warnings in various test files for better clarity and maintainability. - Adjusted assertions in MySQL tests for boolean values to use assert! macro.
1 parent 886740e commit 4893583

File tree

7 files changed

+19
-11
lines changed

7 files changed

+19
-11
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ members = [
1919
]
2020

2121
[workspace.lints.rust]
22-
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(postgres_14)'] }
22+
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(postgres_14)', 'cfg(postgres_9_6)'] }
2323

2424
[package]
2525
name = "sqlx-oldapi"

tests/any/pool.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
#[allow(unused_imports)]
12
use sqlx_oldapi::any::{AnyConnectOptions, AnyPoolOptions};
2-
use sqlx_oldapi::Executor;
3+
#[allow(unused_imports)]
34
use std::sync::atomic::AtomicI32;
45
use std::sync::{
56
atomic::{AtomicUsize, Ordering},

tests/mssql/mssql.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
use futures::TryStreamExt;
22
use sqlx_core::mssql::MssqlRow;
3+
#[allow(unused_imports)]
34
use sqlx_oldapi::mssql::{Mssql, MssqlPoolOptions};
45
use sqlx_oldapi::{
5-
Column, Connection, Execute, Executor, MssqlConnection, Row, Statement, TypeInfo,
6+
Column, Connection, Executor, MssqlConnection, Row, Statement, TypeInfo,
67
};
78
use sqlx_test::new;
9+
#[allow(unused_imports)]
810
use std::sync::atomic::{AtomicI32, Ordering};
11+
#[allow(unused_imports)]
912
use std::time::Duration;
1013

1114
#[sqlx_macros::test]

tests/mssql/types.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,9 @@ test_type!(numeric<f64>(Mssql,
9999
"CAST(0.0000000000000001 AS NUMERIC(38,16))" == 0.0000000000000001_f64,
100100
"CAST(939399419.1225182 AS NUMERIC(15,2))" == 939399419.12_f64,
101101
"CAST(939399419.1225182 AS DECIMAL(15,2))" == 939399419.12_f64,
102-
"CAST(123456789.0123456789 AS NUMERIC(38,10))" == 123_456_789.012_345_678_9_f64,
103-
"CAST(123456789.0123456789012 AS NUMERIC(38,13))" == 123_456_789.012_345_678_901_2_f64,
104-
"CAST(123456789.012345678901234 AS NUMERIC(38,15))" == 123_456_789.012_345_678_901_234_f64,
102+
"CAST(123456789.0123456789 AS NUMERIC(38,10))" == 123_456_789.012_345_67_f64,
103+
"CAST(123456789.0123456789012 AS NUMERIC(38,13))" == 123_456_789.012_345_67_f64,
104+
"CAST(123456789.012345678901234 AS NUMERIC(38,15))" == 123_456_789.012_345_67_f64,
105105
"CAST(1.0000000000000001 AS NUMERIC(18,16))" == 1.0000000000000001_f64,
106106
"CAST(0.99999999999999 AS NUMERIC(18,14))" == 0.99999999999999_f64,
107107
"CAST(2.00000000000001 AS NUMERIC(18,14))" == 2.00000000000001_f64,
@@ -265,8 +265,8 @@ mod decimal {
265265
"CAST('-1.0000' AS MONEY)" == -1.0000,
266266
"CAST('2.15' AS MONEY)" == 2.15,
267267
"CAST('214748.3647' AS SMALLMONEY)" == 214748.3647,
268-
"CAST('922337203685477.5807' AS MONEY)" == 922337203685477.5807,
269-
"CAST('-922337203685477.5808' AS MONEY)" == -922337203685477.5808,
268+
"CAST('922337203685477.5807' AS MONEY)" == 922_337_203_685_477.6,
269+
"CAST('-922337203685477.5808' AS MONEY)" == -922_337_203_685_477.6,
270270
"CAST('214748.3647' AS SMALLMONEY)" == 214748.3647,
271271
"CAST('-214748.3648' AS SMALLMONEY)" == -214748.3648,
272272
));

tests/mysql/types.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![allow(clippy::approx_constant)]
2+
13
extern crate time_ as time;
24

35
#[cfg(feature = "decimal")]
@@ -331,7 +333,7 @@ CREATE TEMPORARY TABLE with_bits (
331333
// as bool
332334
let row = conn.fetch_one("SELECT value_1 FROM with_bits").await?;
333335
let v1: bool = row.try_get(0)?;
334-
assert_eq!(v1, true);
336+
assert!(v1);
335337

336338
// switch the bit
337339
sqlx_oldapi::query("UPDATE with_bits SET value_1 = NOT value_1")
@@ -340,7 +342,7 @@ CREATE TEMPORARY TABLE with_bits (
340342

341343
let row = conn.fetch_one("SELECT value_1 FROM with_bits").await?;
342344
let v1: bool = row.try_get(0)?;
343-
assert_eq!(v1, false);
345+
assert!(!v1);
344346

345347
Ok(())
346348
}

tests/postgres/types.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#![allow(unexpected_cfgs)]
12
extern crate time_ as time;
23

34
use std::ops::Bound;

tests/sqlite/types.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
#![allow(clippy::approx_constant)]
22
extern crate time_ as time;
33

4-
use sqlx_core::row::Row;
4+
#[allow(unused_imports)]
55
use sqlx_oldapi::sqlite::{Sqlite, SqliteRow};
6+
#[allow(unused_imports)]
67
use sqlx_test::new;
78
use sqlx_test::test_type;
89

0 commit comments

Comments
 (0)