summary refs log tree commit diff
path: root/bin/clippy
blob: 66df660435222a1f2b420fe067c979ace20bb3a5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/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=(
    # To be resolved.
    let_unit_value
    question_mark
    range_plus_one

    # 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

cargo clippy --all-features -- ${SUPPRESS[@]/#/-Aclippy::} "$@"