From 2ab7565bd8fc2c6226c7820605fdfa1aa62937d0 Mon Sep 17 00:00:00 2001 From: Austin Bonander Date: Tue, 20 Aug 2024 01:26:53 -0700 Subject: [PATCH] chore: configure clippy cast lints at workspace level --- Cargo.toml | 9 +++++++++ sqlx-bench/Cargo.toml | 3 +++ sqlx-cli/Cargo.toml | 3 +++ sqlx-core/Cargo.toml | 3 +++ sqlx-core/src/lib.rs | 4 ---- sqlx-macros/Cargo.toml | 3 +++ sqlx-mysql/Cargo.toml | 3 +++ sqlx-postgres/Cargo.toml | 3 +++ sqlx-postgres/src/lib.rs | 4 ---- sqlx-sqlite/Cargo.toml | 3 +++ sqlx-test/Cargo.toml | 3 +++ 11 files changed, 33 insertions(+), 8 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index b508f4dd..fad4f9b1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -187,6 +187,15 @@ criterion = { version = "0.5.1", features = ["async_tokio"] } # Enable testing with SQLCipher if specifically requested. libsqlite3-sys = { version = "0.30.1", features = ["bundled-sqlcipher"] } +# Common lint settings for the workspace +[workspace.lints.clippy] +# https://github.com/launchbadge/sqlx/issues/3440 +cast_possible_truncation = 'deny' +cast_possible_wrap = 'deny' +cast_sign_loss = 'deny' +# See `clippy.toml` +disallowed_methods = 'deny' + # # Any # diff --git a/sqlx-bench/Cargo.toml b/sqlx-bench/Cargo.toml index a2028e40..0aa95320 100644 --- a/sqlx-bench/Cargo.toml +++ b/sqlx-bench/Cargo.toml @@ -42,3 +42,6 @@ required-features = ["postgres"] name = "sqlite_fetch_all" harness = false required-features = ["sqlite"] + +[lints] +workspace = true diff --git a/sqlx-cli/Cargo.toml b/sqlx-cli/Cargo.toml index 1ae27836..6ddc71de 100644 --- a/sqlx-cli/Cargo.toml +++ b/sqlx-cli/Cargo.toml @@ -68,3 +68,6 @@ completions = ["dep:clap_complete"] [dev-dependencies] assert_cmd = "2.0.11" tempfile = "3.10.1" + +[lints] +workspace = true diff --git a/sqlx-core/Cargo.toml b/sqlx-core/Cargo.toml index 5d1198bc..60f9573a 100644 --- a/sqlx-core/Cargo.toml +++ b/sqlx-core/Cargo.toml @@ -94,3 +94,6 @@ hashbrown = "0.14.5" [dev-dependencies] sqlx = { workspace = true, features = ["postgres", "sqlite", "mysql", "migrate", "macros", "time", "uuid"] } tokio = { version = "1", features = ["rt"] } + +[lints] +workspace = true diff --git a/sqlx-core/src/lib.rs b/sqlx-core/src/lib.rs index 86367604..df4b2cc2 100644 --- a/sqlx-core/src/lib.rs +++ b/sqlx-core/src/lib.rs @@ -15,10 +15,6 @@ #![recursion_limit = "512"] #![warn(future_incompatible, rust_2018_idioms)] #![allow(clippy::needless_doctest_main, clippy::type_complexity)] -// See `clippy.toml` at the workspace root -#![deny(clippy::disallowed_methods)] -#![deny(clippy::cast_possible_truncation)] -#![deny(clippy::cast_possible_wrap)] // The only unsafe code in SQLx is that necessary to interact with native APIs like with SQLite, // and that can live in its own separate driver crate. #![forbid(unsafe_code)] diff --git a/sqlx-macros/Cargo.toml b/sqlx-macros/Cargo.toml index 813a00b4..b34c8123 100644 --- a/sqlx-macros/Cargo.toml +++ b/sqlx-macros/Cargo.toml @@ -49,3 +49,6 @@ sqlx-macros-core = { workspace = true } proc-macro2 = { version = "1.0.36", default-features = false } syn = { version = "2.0.52", default-features = false, features = ["parsing", "proc-macro"] } quote = { version = "1.0.26", default-features = false } + +[lints] +workspace = true diff --git a/sqlx-mysql/Cargo.toml b/sqlx-mysql/Cargo.toml index 174b5291..493562c7 100644 --- a/sqlx-mysql/Cargo.toml +++ b/sqlx-mysql/Cargo.toml @@ -71,3 +71,6 @@ tracing = { version = "0.1.37", features = ["log"] } whoami = { version = "1.2.1", default-features = false } serde = { version = "1.0.144", optional = true } + +[lints] +workspace = true diff --git a/sqlx-postgres/Cargo.toml b/sqlx-postgres/Cargo.toml index 6534592d..55a94ece 100644 --- a/sqlx-postgres/Cargo.toml +++ b/sqlx-postgres/Cargo.toml @@ -83,3 +83,6 @@ features = ["postgres", "derive"] [target.'cfg(target_os = "windows")'.dependencies] etcetera = "0.8.0" + +[lints] +workspace = true diff --git a/sqlx-postgres/src/lib.rs b/sqlx-postgres/src/lib.rs index 2bfc30d8..c50f5306 100644 --- a/sqlx-postgres/src/lib.rs +++ b/sqlx-postgres/src/lib.rs @@ -1,8 +1,4 @@ //! **PostgreSQL** database driver. -// https://github.com/launchbadge/sqlx/issues/3440 -#![deny(clippy::cast_possible_truncation)] -#![deny(clippy::cast_possible_wrap)] -#![deny(clippy::cast_sign_loss)] #[macro_use] extern crate sqlx_core; diff --git a/sqlx-sqlite/Cargo.toml b/sqlx-sqlite/Cargo.toml index c530d578..6b492353 100644 --- a/sqlx-sqlite/Cargo.toml +++ b/sqlx-sqlite/Cargo.toml @@ -60,3 +60,6 @@ workspace = true [dev-dependencies] sqlx = { workspace = true, default-features = false, features = ["macros", "runtime-tokio", "tls-none"] } + +[lints] +workspace = true diff --git a/sqlx-test/Cargo.toml b/sqlx-test/Cargo.toml index 32708596..af76d556 100644 --- a/sqlx-test/Cargo.toml +++ b/sqlx-test/Cargo.toml @@ -9,3 +9,6 @@ sqlx = { default-features = false, path = ".." } env_logger = "0.11" dotenvy = "0.15.0" anyhow = "1.0.26" + +[lints] +workspace = true