From 141a92c9650046de7178e93008b77c3013a6dc34 Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Sun, 30 May 2021 09:29:10 +0200 Subject: [PATCH 1/2] CI: set clippy targets to 'all' --- .github/workflows/CICD.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/CICD.yml b/.github/workflows/CICD.yml index 72682ff03..5ac9295d4 100644 --- a/.github/workflows/CICD.yml +++ b/.github/workflows/CICD.yml @@ -84,7 +84,7 @@ jobs: - name: Install `rust` toolchain uses: actions-rs/toolchain@v1 with: - toolchain: stable + toolchain: nightly default: true profile: minimal # minimal component installation (ie, no documentation) components: clippy @@ -94,7 +94,7 @@ jobs: run: | # `clippy` testing # * convert any warnings to GHA UI annotations; ref: - S=$(cargo +nightly clippy --target=${{ matrix.job.target }} ${{ matrix.job.cargo-options }} ${{ steps.vars.outputs.CARGO_FEATURES_OPTION }} -- -D warnings 2>&1) && printf "%s\n" "$S" || { printf "%s\n" "$S" ; printf "%s" "$S" | sed -E -n -e '/^error:/{' -e "N; s/^error:[[:space:]]+(.*)\\n[[:space:]]+-->[[:space:]]+(.*):([0-9]+):([0-9]+).*$/::warning file=\2,line=\3,col=\4::WARNING: \`cargo clippy\`: \1/p;" -e '}' ; } + S=$(cargo +nightly clippy --all-targets ${{ matrix.job.cargo-options }} ${{ steps.vars.outputs.CARGO_FEATURES_OPTION }} -- -D warnings 2>&1) && printf "%s\n" "$S" || { printf "%s\n" "$S" ; printf "%s" "$S" | sed -E -n -e '/^error:/{' -e "N; s/^error:[[:space:]]+(.*)\\n[[:space:]]+-->[[:space:]]+(.*):([0-9]+):([0-9]+).*$/::warning file=\2,line=\3,col=\4::WARNING: \`cargo clippy\`: \1/p;" -e '}' ; } min_version: name: MinRustV # Minimum supported rust version From cda04eb690520d938c1983c941209724d18f9d26 Mon Sep 17 00:00:00 2001 From: Jan Scheer Date: Sun, 30 May 2021 12:42:46 +0200 Subject: [PATCH 2/2] docs: add note for clippy usage --- DEVELOPER_INSTRUCTIONS.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/DEVELOPER_INSTRUCTIONS.md b/DEVELOPER_INSTRUCTIONS.md index c3b20dd46..3aa8b5b12 100644 --- a/DEVELOPER_INSTRUCTIONS.md +++ b/DEVELOPER_INSTRUCTIONS.md @@ -21,7 +21,7 @@ if changes are not reflected in the report then run `cargo clean` and run the a ### Using Stable Rust -If you are using stable version of Rust that doesn't enable code coverage instrumentation by default +If you are using stable version of Rust that doesn't enable code coverage instrumentation by default then add `-Z-Zinstrument-coverage` flag to `RUSTFLAGS` env variable specified above. @@ -36,3 +36,7 @@ To use the provided hook: 2. Run `pre-commit install` while in the repository directory Your git commits will then automatically be checked. If a check fails, an error message will explain why, and your commit will be canceled. You can then make the suggested changes, and run `git commit ...` again. + +### Using Clippy + +The `msrv` key in the clippy configuration file `clippy.toml` is used to disable lints pertaining to newer features by specifying the minimum supported Rust version (MSRV). However, this key is only supported on `nightly`. To invoke clippy without errors, use `cargo +nightly clippy`. In order to also check tests and non-default crate features, use `cargo +nightly clippy --all-targets --all-features`.