makefile: add `cargo clippy` to tests if cargo is available
authorRaphaël Gomès <rgomes@octobus.net>
Tue, 10 Jan 2023 11:39:53 +0100
changeset 49939 0a58aaa2009c
parent 49938 e3274e02d08e
child 49940 86958104b6ca
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`.
Makefile
--- 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