changeset 50012:0a58aaa2009c

makefile: add `cargo clippy` to tests if cargo is available This linter mostly makes our code more idiomatic, less surprising, has good suggestions and catches bugs. It's widely used in the Rust community and now part of the default toolchain when using `rustup`.
author Raphaël Gomès <rgomes@octobus.net>
date Tue, 10 Jan 2023 11:39:53 +0100
parents e3274e02d08e
children 86958104b6ca
files Makefile
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile	Tue Jan 10 11:25:24 2023 +0100
+++ b/Makefile	Tue Jan 10 11:39:53 2023 +0100
@@ -138,6 +138,7 @@
         # Run Rust tests if cargo is installed
 	if command -v $(CARGO) >/dev/null 2>&1; then \
 		$(MAKE) rust-tests; \
+		$(MAKE) cargo-clippy; \
 	fi
 	cd tests && $(PYTHON) run-tests.py $(TESTFLAGS)
 
@@ -155,6 +156,10 @@
 	cd $(HGROOT)/rust \
 		&& $(CARGO) test --quiet --all --features "$(HG_RUST_FEATURES)"
 
+cargo-clippy:
+	cd $(HGROOT)/rust \
+		&& $(CARGO) clippy --all --features "$(HG_RUST_FEATURES)"
+
 check-code:
 	hg manifest | xargs python contrib/check-code.py