Rust-for-Linux/linux

Split `-Dclippy::*` categories into individual lints

ojeda opened this issue · 1 comments

ojeda commented

Denying entire categories is convenient, and works fine for the moment since we pin the compiler version.

However, in the future, we will want to carefully control which lints are enabled, so that new lints do not break the build. Even nowadays, it may make upgrades easier when new lints are added that we do not pass.

linux/Makefile

Lines 457 to 469 in d2e3115

export rust_common_flags := --edition=2021 \
-Zbinary_dep_depinfo=y \
-Dunsafe_op_in_unsafe_fn -Drust_2018_idioms \
-Dunreachable_pub -Dnon_ascii_idents \
-Wmissing_docs \
-Drustdoc::missing_crate_level_docs \
-Dclippy::correctness -Dclippy::style \
-Dclippy::suspicious -Dclippy::complexity \
-Dclippy::perf \
-Dclippy::let_unit_value -Dclippy::mut_mut \
-Dclippy::needless_bitwise_bool \
-Dclippy::needless_continue \
-Wclippy::dbg_macro

ojeda commented

We may also want to still keep the groups as -W, like C does with e.g. -Wall, if the groups are conservative enough (so that we do not break the build under WERROR often).

Or, if the groups get new lints often and we typically hit those cases, we could just -W the groups under W=1 only (or similar). That way we have an easy way of testing/cleaning things up, e.g. when a new Rust version is released.