comparison Makefile @ 49939: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 3c37cb7bce61
comparison
equal deleted inserted replaced
49938:e3274e02d08e 49939:0a58aaa2009c
136 136
137 tests: 137 tests:
138 # Run Rust tests if cargo is installed 138 # Run Rust tests if cargo is installed
139 if command -v $(CARGO) >/dev/null 2>&1; then \ 139 if command -v $(CARGO) >/dev/null 2>&1; then \
140 $(MAKE) rust-tests; \ 140 $(MAKE) rust-tests; \
141 $(MAKE) cargo-clippy; \
141 fi 142 fi
142 cd tests && $(PYTHON) run-tests.py $(TESTFLAGS) 143 cd tests && $(PYTHON) run-tests.py $(TESTFLAGS)
143 144
144 test-%: 145 test-%:
145 cd tests && $(PYTHON) run-tests.py $(TESTFLAGS) $@ 146 cd tests && $(PYTHON) run-tests.py $(TESTFLAGS) $@
152 cd tests && $(HGPYTHONS)/$*/bin/python run-tests.py $(TESTFLAGS) 153 cd tests && $(HGPYTHONS)/$*/bin/python run-tests.py $(TESTFLAGS)
153 154
154 rust-tests: 155 rust-tests:
155 cd $(HGROOT)/rust \ 156 cd $(HGROOT)/rust \
156 && $(CARGO) test --quiet --all --features "$(HG_RUST_FEATURES)" 157 && $(CARGO) test --quiet --all --features "$(HG_RUST_FEATURES)"
158
159 cargo-clippy:
160 cd $(HGROOT)/rust \
161 && $(CARGO) clippy --all --features "$(HG_RUST_FEATURES)"
157 162
158 check-code: 163 check-code:
159 hg manifest | xargs python contrib/check-code.py 164 hg manifest | xargs python contrib/check-code.py
160 165
161 format-c: 166 format-c: