fif/clippy.sh

54 lines
1.7 KiB
Bash
Raw Permalink Normal View History

2021-02-21 16:08:08 +00:00
#!/bin/bash
set -e
source "$HOME"/.cargo/env || true
_extra=""
2021-06-14 08:33:34 +00:00
_ver=""
if [ "$1" == "ci" ]; then
# deny on warnings when running in CI
_extra="-Dwarnings"
2021-06-14 06:53:41 +00:00
elif [ "$1" == "nightly" ]; then
_ver="+nightly"
fi
# allow find to fail
find . -name '*.rs' -exec touch "{}" \; || true
2021-06-14 08:27:50 +00:00
_backends=( "xdg-mime-backend" "infer-backend" )
for backend in "${_backends[@]}"; do
cargo $_ver clippy --tests --features="$backend" -- \
-W clippy::nursery \
-W clippy::perf \
-W clippy::pedantic \
-W clippy::complexity \
-W clippy::cargo \
-W clippy::float_cmp_const \
-W clippy::lossy_float_literal \
-W clippy::multiple_inherent_impl \
-W clippy::string_to_string \
-A clippy::unused_io_amount \
-A clippy::redundant_closure_for_method_calls \
-A clippy::shadow_unrelated \
-A clippy::option_if_let_else \
2021-07-06 14:24:02 +00:00
-A clippy::multiple-crate-versions \
2021-08-06 14:36:19 +00:00
-A clippy::cast-possible-truncation \
-A clippy::cast-possible-wrap \
2021-08-28 07:54:01 +00:00
-A clippy::must_use_candidate \
-A clippy::missing_panics_doc \
-A clippy::missing_errors_doc \
2021-06-14 08:27:50 +00:00
"$_extra"
done
2021-02-21 16:08:08 +00:00
# ALLOWS:
# unused_io_amount: there are two places where i want to read up to X bytes and i'm fine with getting less than that
# redundant_closure...: the alternative is often much more verbose
# shadow_unrelated: sometimes things that seem unrelated are actually related ;)
# option_if_let_else: the suggested code is usually harder to read than the original
2021-07-06 14:24:02 +00:00
# multiple_crate_versions: cached uses an old version of hashbrown :c
2021-08-28 07:54:01 +00:00
# cast_possible_truncation: only ever used where it would be totally fine
# cast_possible_wrap: ditto
# must_use_candidate: useless
# missing_panics_doc: the docs are just for me, fif isn't really intended to be used as a library, so this is unneeded
# missing_errors_doc: ditto