diff options
| author | Gary Guo <gary@garyguo.net> | 2026-10-08 14:15:29 +0200 |
|---|---|---|
| committer | Gary Guo <gary@garyguo.net> | 2026-10-11 11:06:46 +0100 |
| commit | d45ef897ecf8d34ca25a3772552a8c75260fe5e1 (patch) | |
| tree | ebf3aa2a0241c807f4f393ebb238a2f8990ff29b /Makefile | |
| parent | 0d9aa4b994379c6e0099737221ed421deb7e1a31 (diff) | |
kbuild: rust: allow `clippy::comparison_chain` globally
The lint would suggest comparison chains to be converted to match on
`Ordering` instead. The suggestions do not always produce more readable
code, and also it can produce false-positive when not all ordering has a
branch.
The issue is known upstream and thus it has been downgraded from style
lints to pedantic lints, which makes it allow-by-default since Rust 1.87.0.
The current kernel MSRV is 1.85.0, and thus the lint still triggers; allow
it globally to match the updated upstream behaviour.
Link: https://rust-lang.zulipchat.com/#narrow/channel/257328-clippy/topic/demote.20some.20lints.20to.20.60pedantic.60
Link: https://rust-lang.github.io/rust-clippy/master/#comparison_chain
Acked-by: Benno Lossin <lossin@kernel.org>
Acked-by: Miguel Ojeda <ojeda@kernel.org>
Link: https://patch.msgid.link/20261008-dev-selfref-v2-1-e280b3c8fba5@garyguo.net/
Signed-off-by: Gary Guo <gary@garyguo.net>
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -476,6 +476,7 @@ KBUILD_USERLDFLAGS := $(USERLDFLAGS) # These flags apply to all Rust code in the tree, including the kernel and # host programs. # +# `-Aclippy::comparison_chain`: the lint has been demoted since 1.87. # `-Aclippy::unwrap_or_default`: the lint is buggy [1] and ignores our # MSRV. It can trigger depending on the optimization level. # [1] https://github.com/rust-lang/rust-clippy/issues/17379 @@ -494,6 +495,7 @@ export rust_common_flags := --edition=2021 \ -Wclippy::cast_lossless \ -Aclippy::collapsible_if \ -Aclippy::collapsible_match \ + -Aclippy::comparison_chain \ -Wclippy::ignored_unit_patterns \ -Aclippy::incompatible_msrv \ -Wclippy::mut_mut \ |
