Repository: rust-lang/rust-bindgen
Pull request #3016 (2024-12-01 03:18:05)

Consolidate clippy configuration
Move all clippy configurations to one central place, except for the expected tests - they seem to require their own handling for now due to a Cargo limitation.



Patch:
diff --git a/Cargo.toml b/Cargo.toml
index 87b464aa..5e6f348f 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -47,6 +47,20 @@ similar = "2.2.1"
 syn = "2.0"
 tempfile = "3"
 
+[workspace.lints.rust]
+# unused_qualifications = "warn"
+
+[workspace.lints.clippy]
+# disallowed-names = "allow"
+# manual-c-str-literals = "allow"
+# missing-safety-doc = "allow"
+# op-ref = "allow"
+# ptr-offset-with-cast = "allow"
+# too-many-arguments = "allow"
+# transmute-int-to-bool = "allow"
+# unnecessary-cast = "allow"
+# useless-transmute  = "allow"
+
 # Config for 'cargo dist'
 [workspace.metadata.dist]
 # The preferred cargo-dist version to use in CI (Cargo.toml SemVer syntax)
diff --git a/bindgen-cli/Cargo.toml b/bindgen-cli/Cargo.toml
index 09a3f554..d1e0bf40 100644
--- a/bindgen-cli/Cargo.toml
+++ b/bindgen-cli/Cargo.toml
@@ -1,3 +1,5 @@
+lints.workspace = true
+
 [package]
 authors = [
     "The rust-bindgen project contributors",
diff --git a/bindgen-integration/Cargo.toml b/bindgen-integration/Cargo.toml
index 13bbcd09..5c8c89d5 100644
--- a/bindgen-integration/Cargo.toml
+++ b/bindgen-integration/Cargo.toml
@@ -1,3 +1,5 @@
+lints.workspace = true
+
 [package]
 name = "bindgen-integration"
 description = "A package to test various bindgen features"
diff --git a/bindgen/Cargo.toml b/bindgen/Cargo.toml
index dd4166de..8f61afe2 100644
--- a/bindgen/Cargo.toml
+++ b/bindgen/Cargo.toml
@@ -1,3 +1,5 @@
+lints.workspace = true
+
 [package]
 authors = [
     "Jyun-Yan You <jyyou.tw@gmail.com>",


Test patch:
diff --git a/bindgen-tests/Cargo.toml b/bindgen-tests/Cargo.toml
index 346be51c..3a13c59c 100644
--- a/bindgen-tests/Cargo.toml
+++ b/bindgen-tests/Cargo.toml
@@ -1,3 +1,5 @@
+lints.workspace = true
+
 [package]
 name = "bindgen-tests"
 version = "0.1.0"
diff --git a/bindgen-tests/tests/expectations/Cargo.toml b/bindgen-tests/tests/expectations/Cargo.toml
index 2f77baf7..975fd166 100644
--- a/bindgen-tests/tests/expectations/Cargo.toml
+++ b/bindgen-tests/tests/expectations/Cargo.toml
@@ -16,17 +16,22 @@ block.workspace = true
 libloading.workspace = true
 objc.workspace = true
 
+# Both of these sections need to be copied here from the workspace because
+# Cargo currently does not allow overriding workspace settings in a member
 [lints.rust]
 ### FIXME: these might need to be fixed,
 ###   esp the calling convention, because it is a hard error now
 # deprecated = "allow"
 # invalid-value = "allow"
 # unsupported_calling_conventions = "allow"
+#
+# Different from the workspace
 dead_code = "allow"
 non-snake-case = "allow"
 non_camel_case_types = "allow"
 non_upper_case_globals = "allow"
 unexpected-cfgs = "allow"
+unused_qualifications = "allow"
 
 [lints.clippy]
 disallowed-names = "allow"
diff --git a/bindgen-tests/tests/quickchecking/Cargo.toml b/bindgen-tests/tests/quickchecking/Cargo.toml
index ca36eb1c..b26ba3b3 100644
--- a/bindgen-tests/tests/quickchecking/Cargo.toml
+++ b/bindgen-tests/tests/quickchecking/Cargo.toml
@@ -1,3 +1,5 @@
+lints.workspace = true
+
 [package]
 name = "quickchecking"
 description = "Bindgen property tests with quickcheck. Generate random valid C code and pass it to the csmith/predicate.py script"