mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2024-11-24 20:48:55 +00:00
65740a6842
Includes some fixes for new clippy checks. A rebuilt dev_container that ships the new toolchain. This allows us to get rid of the annoying cargo clean before running clippy. BUG=b:203142205 TEST=./tools/presubmit Change-Id: I9d486fbcf7b2d468f6a1375ac7df95091a2c1465 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3232277 Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Daniel Verkamp <dverkamp@chromium.org> Commit-Queue: Dennis Kempin <denniskempin@google.com>
88 lines
2.1 KiB
Bash
Executable file
88 lines
2.1 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
# Copyright 2019 The Chromium OS Authors. All rights reserved.
|
|
# Use of this source code is governed by a BSD-style license that can be
|
|
# found in the LICENSE file.
|
|
|
|
# Run `cargo clippy` on all Rust code in crosvm with a mindful set of lints
|
|
# suppressed.
|
|
|
|
set -eo pipefail
|
|
|
|
CLIPPY_ARGS=("$@")
|
|
|
|
# Change into directory of script, which is crosvm/bin.
|
|
cd "$(dirname "${BASH_SOURCE[0]}")"
|
|
|
|
# Jump up to root directory of crosvm repo.
|
|
cd ..
|
|
|
|
SUPPRESS=(
|
|
# TODO(crbug/908640): To be resolved.
|
|
collapsible_if
|
|
comparison_chain
|
|
missing_safety_doc
|
|
wrong_self_convention
|
|
# To be fixed in external libraries
|
|
upper_case_acronyms
|
|
from_over_into
|
|
|
|
# False positives affecting WlVfd @ `devices/src/virtio/wl.rs`.
|
|
# Bug: https://github.com/rust-lang/rust-clippy/issues/6312
|
|
field_reassign_with_default
|
|
|
|
# We don't care about these lints. Okay to remain suppressed globally.
|
|
cast_lossless
|
|
cognitive_complexity
|
|
enum_variant_names
|
|
identity_op
|
|
len_without_is_empty
|
|
len_zero
|
|
match_bool
|
|
match_wild_err_arm
|
|
module_inception
|
|
needless_bool
|
|
new_without_default
|
|
or_fun_call
|
|
should_implement_trait
|
|
single_char_pattern
|
|
too_many_arguments
|
|
trivially_copy_pass_by_ref
|
|
type_complexity
|
|
unreadable_literal
|
|
useless_let_if_seq
|
|
useless_transmute
|
|
new-ret-no-self
|
|
result-unit-err
|
|
)
|
|
|
|
FEATURES=(
|
|
default
|
|
direct
|
|
audio
|
|
gpu
|
|
plugin
|
|
tpm
|
|
usb
|
|
video-decoder
|
|
video-encoder
|
|
wl-dmabuf
|
|
x
|
|
virgl_renderer_next
|
|
composite-disk
|
|
virgl_renderer
|
|
gfxstream
|
|
gdb
|
|
)
|
|
printf -v FEATURES_LIST '%s,' "${FEATURES[@]}"
|
|
|
|
# Need to set pass --sysroot for cargo-clippy manually.
|
|
# cf. https://github.com/rust-lang/rust-clippy/issues/3523
|
|
RUST_SYSROOT=$(rustc --print sysroot)
|
|
RUSTFLAGS="${RUSTFLAGS:-}"
|
|
export RUSTFLAGS="$RUSTFLAGS --sysroot=$RUST_SYSROOT"
|
|
|
|
# TODO(b/192373803): We are skipping a lot of crates by not running on
|
|
# --workspace
|
|
cargo clippy --features ${FEATURES_LIST} --all-targets -- \
|
|
${SUPPRESS[@]/#/-Aclippy::} "${CLIPPY_ARGS[@]}" -D warnings
|