Skip to content

Commit 5327301

Browse files
ojedaintel-lab-lkp
authored andcommitted
rust: relax most deny-level lints to warnings
Since we are starting to support several Rust toolchains, lints (including Clippy ones) now may behave differently and lint groups may include new lints. Therefore, to maximize the chances a given version works, relax some deny-level lints to warnings. It may also make our lives a bit easier while developing new code or refactoring. To be clear, the requirements for in-tree code are still the same, since Rust code still needs to be warning-free (patches should be clean under `WERROR=y`) and the set of lints is not changed. `unsafe_op_in_unsafe_fn` is left unmodified, i.e. as an error, since 1) it is simple enough that it should not have false positives (unlike e.g. `rust_2018_idioms`'s `explicit_outlives_requirements`) and 2) it is becoming the default in the language (warn-by-default in Rust 2024 [1] and ideally an error later on) and thus it should also be very well tested. Link: rust-lang/rust#112038 [1] Signed-off-by: Miguel Ojeda <[email protected]>
1 parent caae6f2 commit 5327301

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

Makefile

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -461,17 +461,17 @@ KBUILD_USERLDFLAGS := $(USERLDFLAGS)
461461
# host programs.
462462
export rust_common_flags := --edition=2021 \
463463
-Zbinary_dep_depinfo=y \
464-
-Dunsafe_op_in_unsafe_fn -Drust_2018_idioms \
465-
-Dunreachable_pub -Dnon_ascii_idents \
464+
-Dunsafe_op_in_unsafe_fn -Wrust_2018_idioms \
465+
-Wunreachable_pub -Wnon_ascii_idents \
466466
-Wmissing_docs \
467-
-Drustdoc::missing_crate_level_docs \
468-
-Dclippy::correctness -Dclippy::style \
469-
-Dclippy::suspicious -Dclippy::complexity \
470-
-Dclippy::perf \
471-
-Dclippy::let_unit_value -Dclippy::mut_mut \
472-
-Dclippy::needless_bitwise_bool \
473-
-Dclippy::needless_continue \
474-
-Dclippy::no_mangle_with_rust_abi \
467+
-Wrustdoc::missing_crate_level_docs \
468+
-Wclippy::correctness -Wclippy::style \
469+
-Wclippy::suspicious -Wclippy::complexity \
470+
-Wclippy::perf \
471+
-Wclippy::let_unit_value -Wclippy::mut_mut \
472+
-Wclippy::needless_bitwise_bool \
473+
-Wclippy::needless_continue \
474+
-Wclippy::no_mangle_with_rust_abi \
475475
-Wclippy::dbg_macro
476476

477477
KBUILD_HOSTCFLAGS := $(KBUILD_USERHOSTCFLAGS) $(HOST_LFS_CFLAGS) $(HOSTCFLAGS)
@@ -573,7 +573,7 @@ KBUILD_RUSTFLAGS := $(rust_common_flags) \
573573
-Csymbol-mangling-version=v0 \
574574
-Crelocation-model=static \
575575
-Zfunction-sections=n \
576-
-Dclippy::float_arithmetic
576+
-Wclippy::float_arithmetic
577577

578578
KBUILD_AFLAGS_KERNEL :=
579579
KBUILD_CFLAGS_KERNEL :=

rust/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ ifneq ($(or $(CONFIG_ARM64),$(and $(CONFIG_RISCV),$(CONFIG_64BIT))),)
421421
endif
422422

423423
$(obj)/core.o: private skip_clippy = 1
424-
$(obj)/core.o: private skip_flags = -Dunreachable_pub
424+
$(obj)/core.o: private skip_flags = -Wunreachable_pub
425425
$(obj)/core.o: private rustc_objcopy = $(foreach sym,$(redirect-intrinsics),--redefine-sym $(sym)=__rust$(sym))
426426
$(obj)/core.o: private rustc_target_flags = $(core-cfgs)
427427
$(obj)/core.o: $(RUST_LIB_SRC)/core/src/lib.rs FORCE
@@ -435,7 +435,7 @@ $(obj)/compiler_builtins.o: $(src)/compiler_builtins.rs $(obj)/core.o FORCE
435435
+$(call if_changed_dep,rustc_library)
436436

437437
$(obj)/alloc.o: private skip_clippy = 1
438-
$(obj)/alloc.o: private skip_flags = -Dunreachable_pub
438+
$(obj)/alloc.o: private skip_flags = -Wunreachable_pub
439439
$(obj)/alloc.o: private rustc_target_flags = $(alloc-cfgs)
440440
$(obj)/alloc.o: $(RUST_LIB_SRC)/alloc/src/lib.rs $(obj)/compiler_builtins.o FORCE
441441
+$(call if_changed_dep,rustc_library)

0 commit comments

Comments
 (0)