Run clippy from the test script

Currently we run clippy in CI using a github action. The invocation has
a couple of shortcomings

1. it does not lint the tests (this requires `--all-targets`)
2. it does not lint the examples

I could not find a way to lint the examples without explicitly linting
each example by name.

Move the clippy control to `test.sh` and add an env var `DO_LINT` to
control it. Remove the explicit CI job and run the linter during the
`Test` job using the stable toolchain.
This commit is contained in:
Tobin C. Harding 2022-06-30 10:40:51 +10:00
parent aa8109a791
commit 74f3a5aeda
2 changed files with 9 additions and 16 deletions

View File

@ -13,6 +13,7 @@ jobs:
- rust: stable
env:
DO_COV: true
DO_LINT: true
AS_DEPENDENCY: true
DO_NO_STD: true
- rust: beta
@ -106,19 +107,3 @@ jobs:
RUSTFLAGS: "-C link-arg=-Tlink.x"
CARGO_TARGET_THUMBV7M_NONE_EABI_RUNNER: "qemu-system-arm -cpu cortex-m3 -machine mps2-an385 -nographic -semihosting-config enable=on,target=native -kernel"
run: cd embedded && cargo run --target thumbv7m-none-eabi
Clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- run: rustup component add clippy
- uses: actions-rs/cargo@v1
with:
command: clippy
args: --all-features -- -D warnings

View File

@ -31,6 +31,14 @@ if [ "$duplicate_dependencies" -ne 0 ]; then
exit 1
fi
if [ "$DO_LINT" = true ]
then
cargo clippy --all-features --all-targets -- -D warnings
cargo clippy --example bip32 -- -D warnings
cargo clippy --example handshake -- -D warnings
cargo clippy --example ecdsa-psbt --features=bitcoinconsensus -- -D warnings
fi
echo "********* Testing std *************"
# Test without any features other than std first
cargo test --verbose --no-default-features --features="std"