zkat / miette

Fancy extension for std::error::Error with pretty, detailed diagnostic printing.
https://docs.rs/miette
Apache License 2.0
1.98k stars 113 forks source link

Fix clippy lints in docs #365

Closed willbush closed 5 months ago

willbush commented 5 months ago

One example:

dape-tester on  main [!+?] is 📦 v0.1.0 via 🦀 v1.79.0-nightly via ❄️  impure (nix-shell-env)
❯ cargo clippy --all-targets
warning: unused imports: `IntoDiagnostic`, `WrapErr`
 --> src/my_internal_file3.rs:1:22
  |
1 | use miette::{miette, IntoDiagnostic, Result, WrapErr};
  |                      ^^^^^^^^^^^^^^          ^^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

warning: question mark operator is useless here
 --> src/my_internal_file3.rs:6:5
  |
6 | /     Ok(version
7 | |         .parse()
8 | |         .map_err(|_| miette!("Invalid version {}", version))?)
  | |______________________________________________________________^
  |
  = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_question_mark
  = note: `#[warn(clippy::needless_question_mark)]` on by default
help: try removing question mark and `Ok()`
  |
6 ~     version
7 +         .parse()
8 +         .map_err(|_| miette!("Invalid version {}", version))
  |

warning: `dape-tester` (bin "dape-tester") generated 2 warnings (run `cargo clippy --fix --bin "dape-tester"` to apply 2 suggestions)
warning: `dape-tester` (bin "dape-tester" test) generated 2 warnings (2 duplicates)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.01s

dape-tester on  main [!+?] is 📦 v0.1.0 via 🦀 v1.79.0-nightly via ❄️  impure (nix-shell-env

Image of above text:

20240412_22h39m37s_grim

Also deleted a commented out unwrap found in lib.rs that's not found in the readme.

zkat commented 5 months ago

Thanks!