From 0532f2265b788a3edbea22ffdf40f0d32860d480 Mon Sep 17 00:00:00 2001 From: Bruce Mitchener Date: Sat, 14 Oct 2023 11:46:55 +0700 Subject: [PATCH 1/4] plot: clippy: Fix `needless_borrow` lints. --- plot/src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plot/src/lib.rs b/plot/src/lib.rs index be511058d..4d2c75bbc 100644 --- a/plot/src/lib.rs +++ b/plot/src/lib.rs @@ -1062,7 +1062,7 @@ mod test { #[test] fn test_parse_version_on_valid_string() { let string = "gnuplot 5.0 patchlevel 7"; - let version = super::parse_version(&string).unwrap(); + let version = super::parse_version(string).unwrap(); assert_eq!(5, version.major); assert_eq!(0, version.minor); assert_eq!("7", &version.patch); @@ -1071,7 +1071,7 @@ mod test { #[test] fn test_parse_gentoo_version() { let string = "gnuplot 5.2 patchlevel 5a (Gentoo revision r0)"; - let version = super::parse_version(&string).unwrap(); + let version = super::parse_version(string).unwrap(); assert_eq!(5, version.major); assert_eq!(2, version.minor); assert_eq!("5a", &version.patch); From c21e97c7e30c2ae2f3fe2df955b49d1535e49031 Mon Sep 17 00:00:00 2001 From: Bruce Mitchener Date: Sat, 14 Oct 2023 11:51:08 +0700 Subject: [PATCH 2/4] ci: Enable clippy for all targets in the workspace. --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index a2523de71..7fb91b02d 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 From dc9f12f13779cf9a298d7777cfd94f98f4c7f1f4 Mon Sep 17 00:00:00 2001 From: Bruce Mitchener Date: Sat, 14 Oct 2023 12:53:51 +0700 Subject: [PATCH 3/4] Update clippy section in `CONTRIBUTING.md`. --- CONTRIBUTING.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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: From 009bc7cf2431adb9dc735c60c2aea2b76a443d7e Mon Sep 17 00:00:00 2001 From: Bruce Mitchener Date: Sat, 14 Oct 2023 13:00:44 +0700 Subject: [PATCH 4/4] Remove instances of `allow(clippy:all)`. These are no longer needed. --- 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 | 3 --- 7 files changed, 21 deletions(-) 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