Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clippy fixes #729

Merged
merged 4 commits into from
Oct 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
3 changes: 0 additions & 3 deletions plot/src/axis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
3 changes: 0 additions & 3 deletions plot/src/candlestick.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 ");

Expand Down
3 changes: 0 additions & 3 deletions plot/src/curve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ impl CurveDefault<Style> 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 = if let Some(axes) = self.axes {
format!("axes {} ", axes.display())
Expand Down
3 changes: 0 additions & 3 deletions plot/src/errorbar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@ impl ErrorBarDefault<Style> 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 = format!("with {} ", self.style.display());

Expand Down
3 changes: 0 additions & 3 deletions plot/src/filledcurve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 = if let Some(axes) = self.axes {
format!("axes {} ", axes.display())
Expand Down
3 changes: 0 additions & 3 deletions plot/src/key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,6 @@ impl 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 = if self.hidden {
return String::from("set key off\n");
Expand Down
7 changes: 2 additions & 5 deletions plot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -438,9 +438,6 @@ impl Figure {
}
}

// 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) -> Vec<u8> {
let mut s = String::new();

Expand Down Expand Up @@ -1062,7 +1059,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);
Expand All @@ -1071,7 +1068,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);
Expand Down