aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiguel Ojeda <[email protected]>2024-09-04 22:43:39 +0200
committerMiguel Ojeda <[email protected]>2024-10-07 21:39:05 +0200
commit7d56786edcbdf58b6367fd7f01d5861214ad1c95 (patch)
tree123478602597212a4c1369df9212a21693839aa6
parent5e7c9b84ad08cc7a41b2ddbbbaccb60057da3860 (diff)
rust: introduce `.clippy.toml`
Some Clippy lints can be configured/tweaked. We will use these knobs to our advantage in later commits. This is done via a configuration file, `.clippy.toml` [1]. The file is currently unstable. This may be a problem in the future, but we can adapt as needed. In addition, we proposed adding Clippy to the Rust CI's RFL job [2], so we should be able to catch issues pre-merge. Thus introduce the file. Link: https://doc.rust-lang.org/clippy/configuration.html [1] Link: https://github.com/rust-lang/rust/pull/128928 [2] Reviewed-by: Alice Ryhl <[email protected]> Reviewed-by: Trevor Gross <[email protected]> Tested-by: Gary Guo <[email protected]> Reviewed-by: Gary Guo <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Miguel Ojeda <[email protected]>
-rw-r--r--.clippy.toml1
-rw-r--r--.gitignore1
-rw-r--r--MAINTAINERS1
-rw-r--r--Makefile3
4 files changed, 6 insertions, 0 deletions
diff --git a/.clippy.toml b/.clippy.toml
new file mode 100644
index 000000000000..f66554cd5c45
--- /dev/null
+++ b/.clippy.toml
@@ -0,0 +1 @@
+# SPDX-License-Identifier: GPL-2.0
diff --git a/.gitignore b/.gitignore
index 56972adb5031..a61e4778d011 100644
--- a/.gitignore
+++ b/.gitignore
@@ -103,6 +103,7 @@ modules.order
# We don't want to ignore the following even if they are dot-files
#
!.clang-format
+!.clippy.toml
!.cocciconfig
!.editorconfig
!.get_maintainer.ignore
diff --git a/MAINTAINERS b/MAINTAINERS
index a097afd76ded..3380b87dcbb9 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -20222,6 +20222,7 @@ B: https://github.com/Rust-for-Linux/linux/issues
C: zulip://rust-for-linux.zulipchat.com
P: https://rust-for-linux.com/contributing
T: git https://github.com/Rust-for-Linux/linux.git rust-next
+F: .clippy.toml
F: Documentation/rust/
F: rust/
F: samples/rust/
diff --git a/Makefile b/Makefile
index 3d32c314dd66..2fe8c97e81bb 100644
--- a/Makefile
+++ b/Makefile
@@ -587,6 +587,9 @@ endif
# Allows the usage of unstable features in stable compilers.
export RUSTC_BOOTSTRAP := 1
+# Allows finding `.clippy.toml` in out-of-srctree builds.
+export CLIPPY_CONF_DIR := $(srctree)
+
export ARCH SRCARCH CONFIG_SHELL BASH HOSTCC KBUILD_HOSTCFLAGS CROSS_COMPILE LD CC HOSTPKG_CONFIG
export RUSTC RUSTDOC RUSTFMT RUSTC_OR_CLIPPY_QUIET RUSTC_OR_CLIPPY BINDGEN
export HOSTRUSTC KBUILD_HOSTRUSTFLAGS