From 5774cab8eaeb2c9c22fd214d4ef8efba771f78f8 Mon Sep 17 00:00:00 2001 From: Bruce Mitchener Date: Sun, 15 Oct 2023 15:41:36 +0700 Subject: [PATCH] Clippy fixes (#729) * plot: clippy: Fix `needless_borrow` lints. * ci: Enable clippy for all targets in the workspace. * Update clippy section in `CONTRIBUTING.md`. * Remove instances of `allow(clippy:all)`. These are no longer needed. --- .github/workflows/ci.yaml | 2 +- CONTRIBUTING.md | 6 +++--- plot/src/axis.rs | 3 --- plot/src/candlestick.rs | 3 --- plot/src/curve.rs | 3 --- plot/src/errorbar.rs | 3 --- plot/src/filledcurve.rs | 3 --- plot/src/key.rs | 3 --- plot/src/lib.rs | 7 ++----- 9 files changed, 6 insertions(+), 27 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 78a921952..541dbeee6 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -64,7 +64,7 @@ jobs: - name: Check for clippy hints if: ${{ matrix.rust == 'stable' }} - run: cargo clippy -- -D warnings + run: cargo clippy --workspace --all-targets -- -D warnings # This fails on 1.64, but works on 1.66 and later. # https://github.com/rust-lang/rust/issues/103306 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 59ae0262e..f8a19653a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -33,11 +33,11 @@ cargo test --all cargo bench ``` -It's a good idea to run clippy and fix any warnings as well: +It's a good idea to run `clippy` and fix any warnings as well: ``` -rustup component add clippy-preview -cargo clippy --all +rustup component add clippy +cargo clippy --workspace --all-targets ``` Finally, run Rustfmt to maintain a common code style: diff --git a/plot/src/axis.rs b/plot/src/axis.rs index 4f068b155..5f7ae4947 100644 --- a/plot/src/axis.rs +++ b/plot/src/axis.rs @@ -155,9 +155,6 @@ where } impl<'a> Script for (Axis, &'a Properties) { - // Allow clippy::format_push_string even with older versions of rust (<1.62) which - // don't have it defined. - #[allow(clippy::all)] fn script(&self) -> String { let &(axis, properties) = self; let axis_ = axis.display(); diff --git a/plot/src/candlestick.rs b/plot/src/candlestick.rs index d1754e8c5..e0a5cbebc 100644 --- a/plot/src/candlestick.rs +++ b/plot/src/candlestick.rs @@ -27,9 +27,6 @@ impl Default for Properties { } impl Script for Properties { - // Allow clippy::format_push_string even with older versions of rust (<1.62) which - // don't have it defined. - #[allow(clippy::all)] fn script(&self) -> String { let mut script = String::from("with candlesticks "); diff --git a/plot/src/curve.rs b/plot/src/curve.rs index a5766ee56..bbddeff1a 100644 --- a/plot/src/curve.rs +++ b/plot/src/curve.rs @@ -38,9 +38,6 @@ impl CurveDefault