Skip to content

Commit 617428e

Browse files
Use workspace lints to control unexpected_cfgs. (#682)
By using `workspace.lints`, we can configure lints once for everything (and then inherit it into the various crates). The lint configuration for `unexpected_cfgs` works in 1.80+ and warns otherwise. Co-authored-by: Thierry Berger <contact@thierryberger.com>
1 parent 364b5b7 commit 617428e

File tree

11 files changed

+32
-2
lines changed

11 files changed

+32
-2
lines changed

Cargo.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,14 @@ members = ["crates/rapier2d", "crates/rapier2d-f64", "crates/rapier_testbed2d",
33
"crates/rapier3d", "crates/rapier3d-f64", "crates/rapier_testbed3d", "crates/rapier_testbed3d-f64", "examples3d", "examples3d-f64", "benchmarks3d", "crates/rapier3d-urdf", "crates/rapier3d-stl"]
44
resolver = "2"
55

6+
[workspace.lints]
7+
rust.unexpected_cfgs = { level = "warn", check-cfg = [
8+
'cfg(feature, values("dim2", "dim3", "f32", "f64"))',
9+
# The `other-backends` feature isn't in the tested3d-f64
10+
# but easier to just ignore it here.
11+
'cfg(feature, values("other-backends"))',
12+
] }
13+
614
[patch.crates-io]
715
#wrapped2d = { git = "https://github.com/Bastacyclop/rust_box2d.git" }
816
#xurdf = { path = "../xurdf/xurdf" }

crates/rapier2d-f64/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ edition = "2021"
2121
[badges]
2222
maintenance = { status = "actively-developed" }
2323

24+
[lints]
25+
workspace = true
26+
2427
[features]
2528
default = ["dim2", "f64"]
2629
dim2 = []

crates/rapier2d/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ edition = "2021"
2121
[badges]
2222
maintenance = { status = "actively-developed" }
2323

24+
[lints]
25+
workspace = true
26+
2427
[features]
2528
default = ["dim2", "f32"]
2629
dim2 = []

crates/rapier3d-f64/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ edition = "2021"
2121
[badges]
2222
maintenance = { status = "actively-developed" }
2323

24+
[lints]
25+
workspace = true
26+
2427
[features]
2528
default = ["dim3", "f64"]
2629
dim3 = []

crates/rapier3d/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ edition = "2021"
2121
[badges]
2222
maintenance = { status = "actively-developed" }
2323

24+
[lints]
25+
workspace = true
26+
2427
[features]
2528
default = ["dim3", "f32"]
2629
dim3 = []

crates/rapier_testbed2d-f64/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ name = "rapier_testbed2d"
2424
path = "../../src_testbed/lib.rs"
2525
required-features = ["dim2"]
2626

27+
[lints]
28+
workspace = true
29+
2730
[features]
2831
default = ["dim2"]
2932
dim2 = []

crates/rapier_testbed2d/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ name = "rapier_testbed2d"
2424
path = "../../src_testbed/lib.rs"
2525
required-features = ["dim2"]
2626

27+
[lints]
28+
workspace = true
29+
2730
[features]
2831
default = ["dim2"]
2932
dim2 = []

crates/rapier_testbed3d-f64/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ name = "rapier_testbed3d"
2424
path = "../../src_testbed/lib.rs"
2525
required-features = ["dim3"]
2626

27+
[lints]
28+
workspace = true
29+
2730
[features]
2831
default = ["dim3"]
2932
dim3 = []

crates/rapier_testbed3d/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ name = "rapier_testbed3d"
2424
path = "../../src_testbed/lib.rs"
2525
required-features = ["dim3"]
2626

27+
[lints]
28+
workspace = true
29+
2730
[features]
2831
default = ["dim3"]
2932
dim3 = []

src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
#![allow(clippy::too_many_arguments)]
1616
#![allow(clippy::needless_range_loop)] // TODO: remove this? I find that in the math code using indices adds clarity.
1717
#![allow(clippy::module_inception)]
18-
#![allow(unexpected_cfgs)] // This happens due to the dim2/dim3/f32/f64 cfg.
1918

2019
#[cfg(all(feature = "dim2", feature = "f32"))]
2120
pub extern crate parry2d as parry;

0 commit comments

Comments
 (0)