From bd326246b9ff91ba2df5747bac7c303621713ed6 Mon Sep 17 00:00:00 2001 From: Martin Nordholts Date: Sat, 28 Nov 2020 15:33:39 +0100 Subject: [PATCH 1/2] 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 --- .github/workflows/CICD.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/CICD.yml b/.github/workflows/CICD.yml index 167b9e1751..0404b57c7d 100644 --- a/.github/workflows/CICD.yml +++ b/.github/workflows/CICD.yml @@ -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: From 042fe83e6514b5aa4b741f99083bec968874516c Mon Sep 17 00:00:00 2001 From: Martin Nordholts Date: Mon, 28 Dec 2020 11:13:07 +0100 Subject: [PATCH 2/2] clippy: Only enforce 'correctness' lints, just print the rest Only the 'correctness' category of lints are 'deny' by default. This is the only clippy lints we want to enforce for now. The other ones we just want to print in the logs. So remove any --deny and --allow arguments. See discussion in #1410. --- .github/workflows/CICD.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CICD.yml b/.github/workflows/CICD.yml index 0404b57c7d..aa0be1deab 100644 --- a/.github/workflows/CICD.yml +++ b/.github/workflows/CICD.yml @@ -27,7 +27,7 @@ jobs: 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 + args: --all-targets --all-features - name: Test uses: actions-rs/cargo@v1 with: