From 491549abb0d0827298b36404c7540a7cec53dc93 Mon Sep 17 00:00:00 2001 From: Yuri Astrakhan Date: Sat, 30 Nov 2024 22:17:35 -0500 Subject: [PATCH] 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. Also, fixed a lot of `unused_qualifications` lints. --- Cargo.toml | 14 ++++++++++++++ bindgen-cli/Cargo.toml | 2 ++ bindgen-integration/Cargo.toml | 2 ++ bindgen-tests/Cargo.toml | 2 ++ bindgen-tests/tests/expectations/Cargo.toml | 5 +++++ bindgen-tests/tests/quickchecking/Cargo.toml | 2 ++ bindgen/Cargo.toml | 2 ++ 7 files changed, 29 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index 87b464aa50..5e6f348f17 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 09a3f554f7..d1e0bf4012 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 13bbcd094d..5c8c89d528 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-tests/Cargo.toml b/bindgen-tests/Cargo.toml index 346be51cd7..3a13c59cfa 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 2f77baf774..975fd16678 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 ca36eb1c37..b26ba3b392 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" diff --git a/bindgen/Cargo.toml b/bindgen/Cargo.toml index dd4166de95..8f61afe23b 100644 --- a/bindgen/Cargo.toml +++ b/bindgen/Cargo.toml @@ -1,3 +1,5 @@ +lints.workspace = true + [package] authors = [ "Jyun-Yan You ",