• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/bash
2
3# Copyright 2019 The Chromium OS Authors. All rights reserved.
4# Use of this source code is governed by a BSD-style license that can be
5# found in the LICENSE file.
6
7# Run `cargo clippy` on all Rust code in crosvm with a mindful set of lints
8# suppressed.
9
10set -euo pipefail
11
12# Change into directory of script, which is crosvm/bin.
13cd "$(dirname "${BASH_SOURCE[0]}")"
14
15# Jump up to root directory of crosvm repo.
16cd ..
17
18SUPPRESS=(
19    # To be resolved.
20    let_unit_value
21    question_mark
22    range_plus_one
23    unit_arg
24
25    # We don't care about these lints. Okay to remain suppressed globally.
26    blacklisted_name
27    cast_lossless
28    cognitive_complexity
29    enum_variant_names
30    identity_op
31    len_without_is_empty
32    len_zero
33    match_bool
34    match_wild_err_arm
35    module_inception
36    needless_bool
37    new_without_default
38    or_fun_call
39    should_implement_trait
40    single_char_pattern
41    too_many_arguments
42    transmute_ptr_to_ptr
43    trivially_copy_pass_by_ref
44    type_complexity
45    unreadable_literal
46    useless_let_if_seq
47    useless_transmute
48)
49
50# Needed or else clippy won't re-run on code that has already compiled.
51cargo clean
52
53cargo clippy --all-features -- ${SUPPRESS[@]/#/-Aclippy::} "$@"
54