mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2024-11-29 03:00:19 +00:00
043aaea79b
Update to the latest rustup release, which (since 1.20.0) installs rustfmt and clippy by default: https://blog.rust-lang.org/2019/10/15/Rustup-1.20.0.html Also update the Rust toolchain version to 1.42.0 to match the version in the CrOS build environment. Additionally, add workarounds for sysroot of cargo clippy. BUG=None TEST=docker/build_crosvm_base.sh && docker/wrapped_smoke_test.sh TEST=bin/clippy on workstation Change-Id: I7ac4db92f4e5f277d77a77fa3c4ffa880f2ae116 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2150988 Tested-by: Keiichi Watanabe <keiichiw@chromium.org> Tested-by: Daniel Verkamp <dverkamp@chromium.org> Reviewed-by: Zach Reizner <zachr@chromium.org> Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
82 lines
2 KiB
Bash
Executable file
82 lines
2 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 -euo pipefail
|
|
|
|
# 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.
|
|
borrowed_box
|
|
char_lit_as_u8
|
|
clone_on_copy
|
|
collapsible_if
|
|
comparison_chain
|
|
extra_unused_lifetimes
|
|
for_kv_map
|
|
inefficient_to_string
|
|
into_iter_on_ref
|
|
let_unit_value
|
|
missing_safety_doc
|
|
needless_doctest_main
|
|
needless_range_loop
|
|
needless_return
|
|
option_map_unit_fn
|
|
question_mark
|
|
range_plus_one
|
|
redundant_clone
|
|
redundant_closure
|
|
single_match
|
|
slow_vector_initialization
|
|
unnecessary_filter_map
|
|
unnecessary_mut_passed
|
|
unneeded_field_pattern
|
|
useless_format
|
|
wrong_self_convention
|
|
|
|
# We don't care about these lints. Okay to remain suppressed globally.
|
|
blacklisted_name
|
|
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
|
|
transmute_ptr_to_ptr
|
|
trivially_copy_pass_by_ref
|
|
type_complexity
|
|
unreadable_literal
|
|
useless_let_if_seq
|
|
useless_transmute
|
|
)
|
|
|
|
# Needed or else clippy won't re-run on code that has already compiled.
|
|
cargo clean
|
|
|
|
# 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"
|
|
|
|
cargo clippy --all-features --all-targets -- ${SUPPRESS[@]/#/-Aclippy::} "$@" \
|
|
-D warnings
|