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`.
--- 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