]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
rust: introduce `.clippy.toml`
authorMiguel Ojeda <ojeda@kernel.org>
Fri, 7 Mar 2025 22:49:18 +0000 (23:49 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 13 Mar 2025 12:01:42 +0000 (13:01 +0100)
commit 7d56786edcbdf58b6367fd7f01d5861214ad1c95 upstream.

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
Link: https://github.com/rust-lang/rust/pull/128928
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Reviewed-by: Trevor Gross <tmgross@umich.edu>
Tested-by: Gary Guo <gary@garyguo.net>
Reviewed-by: Gary Guo <gary@garyguo.net>
Link: https://lore.kernel.org/r/20240904204347.168520-12-ojeda@kernel.org
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
.clippy.toml [new file with mode: 0644]
.gitignore
MAINTAINERS
Makefile

diff --git a/.clippy.toml b/.clippy.toml
new file mode 100644 (file)
index 0000000..f66554c
--- /dev/null
@@ -0,0 +1 @@
+# SPDX-License-Identifier: GPL-2.0
index 56972adb5031aff8b388043e649100c35cb33fdb..a61e4778d011cf706e6784818a1357f392f3a669 100644 (file)
@@ -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
index 6bb4ec0c162a535c8346a0cb803b2d61616534c3..f4e08a0851bd0d6370321216aa5bfc634c60bab0 100644 (file)
@@ -20175,6 +20175,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/
index 8748aa1b2f799a690066f9a6fcbaf9a1b44d6bb9..43cc17c514dc815129a27671f8f016509dda1604 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -588,6 +588,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