From 39c1d4896ce6ee0940a9c5513b047c3314d6f4cd Mon Sep 17 00:00:00 2001 From: Eric Seppanen Date: Wed, 9 Jun 2021 16:43:48 -0700 Subject: [PATCH] add a clippy shell script The clippy maintainers have not provided an easy way for projects to configure the set of lints they would like enabled/disabled. It's particularly bad for projects using workspaces, which can easily lead to duplicated clippy annotations for every crate, library, binary, etc. Add a shell script that runs clippy, with a few unhelpful lints disabled: new_without_default manual_range_contains comparison_chain If you save this in your path under the name "cargo-zclippy" (or whatever name you like), then you can run it as "cargo zclippy" from the shell prompt. If your text editor has rust-analyzer integration, you can also use this new command as a replacement for "cargo check" or "cargo clippy" and see clippy warnings and errors right in the editor. --- run_clippy.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100755 run_clippy.sh diff --git a/run_clippy.sh b/run_clippy.sh new file mode 100755 index 0000000000..3491c32891 --- /dev/null +++ b/run_clippy.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +# If you save this in your path under the name "cargo-zclippy" (or whatever +# name you like), then you can run it as "cargo zclippy" from the shell prompt. +# +# If your text editor has rust-analyzer integration, you can also use this new +# command as a replacement for "cargo check" or "cargo clippy" and see clippy +# warnings and errors right in the editor. +# In vscode, this setting is Rust-analyzer>Check On Save:Command + +cargo clippy "${@:2}" -- -A clippy::new_without_default -A clippy::manual_range_contains -A clippy::comparison_chain