Skip to content

Commit 67c4101

Browse files
ojedaintel-lab-lkp
authored andcommitted
rust: kbuild: rebuild if .clippy.toml changes
We rarely modify `.clippy.toml`, but currently we do not rebuild if that happens, thus it is easy to miss possible changes in lints. Thus rebuild in case of changes. Cc: [email protected] Reported-by: Tamir Duberstein <[email protected]> Closes: Rust-for-Linux#1151 Fixes: 7d56786 ("rust: introduce `.clippy.toml`") Signed-off-by: Miguel Ojeda <[email protected]>
1 parent 22c3335 commit 67c4101

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

rust/Makefile

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ rustdoc_test_quiet=--test-args -q
5757
rustdoc_test_kernel_quiet=>/dev/null
5858
endif
5959

60+
ifeq ($(KBUILD_CLIPPY),1)
61+
clippy_toml := $(srctree)/.clippy.toml
62+
endif
63+
6064
core-cfgs = \
6165
--cfg no_fp_fmt_parse
6266

@@ -405,11 +409,12 @@ quiet_cmd_rustc_procmacro = $(RUSTC_OR_CLIPPY_QUIET) P $@
405409
--crate-name $(patsubst lib%.$(libmacros_extension),%,$(notdir $@)) $<
406410

407411
# Procedural macros can only be used with the `rustc` that compiled it.
408-
$(obj)/$(libmacros_name): $(src)/macros/lib.rs FORCE
412+
$(obj)/$(libmacros_name): $(src)/macros/lib.rs $(clippy_toml) FORCE
409413
+$(call if_changed_dep,rustc_procmacro)
410414

411415
$(obj)/$(libpin_init_internal_name): private rustc_target_flags = --cfg kernel
412-
$(obj)/$(libpin_init_internal_name): $(src)/pin-init/internal/src/lib.rs FORCE
416+
$(obj)/$(libpin_init_internal_name): $(src)/pin-init/internal/src/lib.rs \
417+
$(clippy_toml) FORCE
413418
+$(call if_changed_dep,rustc_procmacro)
414419

415420
quiet_cmd_rustc_library = $(if $(skip_clippy),RUSTC,$(RUSTC_OR_CLIPPY_QUIET)) L $@
@@ -495,7 +500,8 @@ endif
495500

496501
$(obj)/compiler_builtins.o: private skip_gendwarfksyms = 1
497502
$(obj)/compiler_builtins.o: private rustc_objcopy = -w -W '__*'
498-
$(obj)/compiler_builtins.o: $(src)/compiler_builtins.rs $(obj)/core.o FORCE
503+
$(obj)/compiler_builtins.o: $(src)/compiler_builtins.rs $(obj)/core.o \
504+
$(clippy_toml) FORCE
499505
+$(call if_changed_rule,rustc_library)
500506

501507
$(obj)/pin_init.o: private skip_gendwarfksyms = 1

0 commit comments

Comments
 (0)