Skip to contentSkip to conversation

rust: kbuild: rebuild if `.clippy.toml` changes

PATCH Superseded Miguel Ojeda 3 participants 3 messages May 20, 2025

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Miguel Ojeda

author maintainer
#0 lore raw

PATCH 1/1 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.

---
 rust/Makefile | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
rust/Makefile +5 -3
index 3aca903a7d08..0dcc9ba0d225 100644
@@ -405,11 +405,12 @@ quiet_cmd_rustc_procmacro = $(RUSTC_OR_CLIPPY_QUIET) P $@
 		--crate-name $(patsubst lib%.$(libmacros_extension),%,$(notdir $@)) $<
 
 # Procedural macros can only be used with the `rustc` that compiled it.
-$(obj)/$(libmacros_name): $(src)/macros/lib.rs FORCE
+$(obj)/$(libmacros_name): $(src)/macros/lib.rs $(srctree)/.clippy.toml FORCE
 	+$(call if_changed_dep,rustc_procmacro)
 
 $(obj)/$(libpin_init_internal_name): private rustc_target_flags = --cfg kernel
-$(obj)/$(libpin_init_internal_name): $(src)/pin-init/internal/src/lib.rs FORCE
+$(obj)/$(libpin_init_internal_name): $(src)/pin-init/internal/src/lib.rs \
+    $(srctree)/.clippy.toml FORCE
 	+$(call if_changed_dep,rustc_procmacro)
 
 quiet_cmd_rustc_library = $(if $(skip_clippy),RUSTC,$(RUSTC_OR_CLIPPY_QUIET)) L $@
@@ -495,7 +496,8 @@ endif
 
 $(obj)/compiler_builtins.o: private skip_gendwarfksyms = 1
 $(obj)/compiler_builtins.o: private rustc_objcopy = -w -W '__*'
-$(obj)/compiler_builtins.o: $(src)/compiler_builtins.rs $(obj)/core.o FORCE
+$(obj)/compiler_builtins.o: $(src)/compiler_builtins.rs $(obj)/core.o \
+    $(srctree)/.clippy.toml FORCE
 	+$(call if_changed_rule,rustc_library)
 
 $(obj)/pin_init.o: private skip_gendwarfksyms = 1

base-commit: 22c3335c5dcd33063fe1894676a3a6ff1008d506

Signature · 1 line
2.49.0
#1 lore raw
Quoted 6 lines · Miguel Ojeda

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.

Quoted 8 lines
---
 rust/Makefile | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

It is possible to do this only if CLIPPY=1?

#2 lore raw
Quoted 2 lines · Tamir Duberstein

It is possible to do this only if CLIPPY=1?

I kept it simple on purpose, since we will not save much (changing .clippy.toml is quite rare to begin with), but I can add a conditional (likely in a variable). Not sure if it is worth it.

Cheers,
Miguel