Skip to content

Commit

Permalink
chore: configure clippy cast lints at workspace level
Browse files Browse the repository at this point in the history
  • Loading branch information
abonander committed Aug 24, 2024
1 parent 1f669ae commit 2ab7565
Show file tree
Hide file tree
Showing 11 changed files with 33 additions and 8 deletions.
9 changes: 9 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
#
Expand Down
3 changes: 3 additions & 0 deletions sqlx-bench/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,6 @@ required-features = ["postgres"]
name = "sqlite_fetch_all"
harness = false
required-features = ["sqlite"]

[lints]
workspace = true
3 changes: 3 additions & 0 deletions sqlx-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,6 @@ completions = ["dep:clap_complete"]
[dev-dependencies]
assert_cmd = "2.0.11"
tempfile = "3.10.1"

[lints]
workspace = true
3 changes: 3 additions & 0 deletions sqlx-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 0 additions & 4 deletions sqlx-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
3 changes: 3 additions & 0 deletions sqlx-macros/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 3 additions & 0 deletions sqlx-mysql/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 3 additions & 0 deletions sqlx-postgres/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,6 @@ features = ["postgres", "derive"]

[target.'cfg(target_os = "windows")'.dependencies]
etcetera = "0.8.0"

[lints]
workspace = true
4 changes: 0 additions & 4 deletions sqlx-postgres/src/lib.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
3 changes: 3 additions & 0 deletions sqlx-sqlite/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,6 @@ workspace = true

[dev-dependencies]
sqlx = { workspace = true, default-features = false, features = ["macros", "runtime-tokio", "tls-none"] }

[lints]
workspace = true
3 changes: 3 additions & 0 deletions sqlx-test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,6 @@ sqlx = { default-features = false, path = ".." }
env_logger = "0.11"
dotenvy = "0.15.0"
anyhow = "1.0.26"

[lints]
workspace = true

0 comments on commit 2ab7565

Please sign in to comment.