Add Clippy linter step to CICD

Run the linter on the minimum supported rust version; otherwise we will
get lint warnings for things that require a too high Rust toolchain
version to fix.

Allow the following checks, since we already violate them our code:
- clippy::new-without-default
- clippy::match-bool
- clippy::if_same_then_else

Eventually we should fix these lint issues and then disallow them to
prevent them from coming back in other places.

The clippy args used is recommended here:
https://github.com/rust-lang/rust-clippy#travis-ci
This commit is contained in:
Martin Nordholts 2020-11-28 15:33:39 +01:00 committed by David Peter
parent 73d9a95862
commit 28f3f3c9c9

View File

@ -22,6 +22,12 @@ jobs:
toolchain: ${{ env.MIN_SUPPORTED_RUST_VERSION }}
default: true
profile: minimal # minimal component installation (ie, no documentation)
components: clippy
- name: Run clippy (on minimum supported rust version to prevent warnings we can't fix)
uses: actions-rs/cargo@v1
with:
command: clippy
args: --all-targets --all-features -- --deny warnings --allow clippy::new-without-default --allow clippy::match-bool --allow clippy::if_same_then_else
- name: Test
uses: actions-rs/cargo@v1
with: