Skip to content

Commit 211871b

Browse files
committed
Enforce clippy lints on test code in CI
Now that we've fixed many of the lints clippy cares about for our test code, switch to enforcing the lints in `--tests` as well. We disable a few lints that require substantial number of changes to our existing tests, sadly, though they'd probably be good changes to make at some point.
1 parent 0999a9b commit 211871b

File tree

1 file changed

+109
-102
lines changed

1 file changed

+109
-102
lines changed

ci/check-lint.sh

Lines changed: 109 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -1,105 +1,112 @@
11
#!/bin/sh
22
set -e
33
set -x
4-
RUSTFLAGS='-D warnings' cargo clippy -- \
5-
`# Things clippy defaults to allowing but we should avoid` \
6-
-D clippy::clone_on_ref_ptr \
7-
`# Things where clippy is just wrong` \
8-
-A clippy::unwrap-or-default \
9-
-A clippy::upper_case_acronyms \
10-
`# Things where we do odd stuff on purpose ` \
11-
-A clippy::unusual_byte_groupings \
12-
-A clippy::unit_arg \
13-
`# Errors` \
14-
-A clippy::erasing_op \
15-
-A clippy::never_loop \
16-
`# Warnings` \
17-
-A renamed_and_removed_lints \
18-
-A clippy::blocks_in_conditions \
19-
-A clippy::borrow_deref_ref \
20-
-A clippy::clone_on_copy \
21-
-A clippy::collapsible_else_if \
22-
-A clippy::collapsible_if \
23-
-A clippy::collapsible_match \
24-
-A clippy::comparison_chain \
25-
-A clippy::doc_lazy_continuation \
26-
-A clippy::drain_collect \
27-
-A clippy::drop_non_drop \
28-
-A clippy::enum_variant_names \
29-
-A clippy::explicit_auto_deref \
30-
-A clippy::extra_unused_lifetimes \
31-
-A clippy::for_kv_map \
32-
-A clippy::from_over_into \
33-
-A clippy::get_first \
34-
-A clippy::identity_op \
35-
-A clippy::if_same_then_else \
36-
-A clippy::inconsistent_digit_grouping \
37-
-A clippy::iter_kv_map \
38-
-A clippy::iter_skip_next \
39-
-A clippy::large_enum_variant \
40-
-A clippy::legacy_numeric_constants \
41-
-A clippy::len_without_is_empty \
42-
-A clippy::len_zero \
43-
-A clippy::let_and_return \
44-
-A clippy::manual_div_ceil `# to be removed once we hit MSRV 1.73.0` \
45-
-A clippy::manual_filter \
46-
-A clippy::manual_map \
47-
-A clippy::manual_memcpy \
48-
-A clippy::manual_inspect \
49-
-A clippy::manual_range_contains \
50-
-A clippy::manual_range_patterns \
51-
-A clippy::manual_saturating_arithmetic \
52-
-A clippy::manual_strip \
53-
-A clippy::map_clone \
54-
-A clippy::map_flatten \
55-
-A clippy::match_like_matches_macro \
56-
-A clippy::match_ref_pats \
57-
-A clippy::multiple_bound_locations \
58-
-A clippy::mut_mutex_lock \
59-
-A clippy::needless_bool \
60-
-A clippy::needless_borrow \
61-
-A clippy::needless_borrowed_reference \
62-
-A clippy::needless_borrows_for_generic_args \
63-
-A clippy::needless_lifetimes \
64-
-A clippy::needless_question_mark \
65-
-A clippy::needless_range_loop \
66-
-A clippy::needless_return \
67-
-A clippy::new_without_default \
68-
-A clippy::non_minimal_cfg \
69-
-A clippy::op_ref \
70-
-A clippy::option_as_ref_deref \
71-
-A clippy::option_map_or_none \
72-
-A clippy::option_map_unit_fn \
73-
-A clippy::precedence \
74-
-A clippy::ptr_arg \
75-
-A clippy::question_mark \
76-
-A clippy::readonly_write_lock \
77-
-A clippy::redundant_closure \
78-
-A clippy::redundant_field_names \
79-
-A clippy::redundant_guards \
80-
-A clippy::redundant_pattern_matching \
81-
-A clippy::redundant_slicing \
82-
-A clippy::redundant_static_lifetimes \
83-
-A clippy::result_large_err \
84-
-A clippy::result_unit_err \
85-
-A clippy::search_is_some \
86-
-A clippy::single_char_pattern \
87-
-A clippy::single_match \
88-
-A clippy::slow_vector_initialization \
89-
-A clippy::tabs_in_doc_comments \
90-
-A clippy::to_string_in_format_args \
91-
-A clippy::too_many_arguments \
92-
-A clippy::toplevel_ref_arg \
93-
-A clippy::type_complexity \
94-
-A clippy::unnecessary_cast \
95-
-A clippy::unnecessary_get_then_check \
96-
-A clippy::unnecessary_lazy_evaluations \
97-
-A clippy::unnecessary_mut_passed \
98-
-A clippy::unnecessary_sort_by \
99-
-A clippy::unnecessary_to_owned \
100-
-A clippy::unnecessary_unwrap \
101-
-A clippy::unused_unit \
102-
-A clippy::useless_conversion \
103-
-A clippy::unnecessary_map_or `# to be removed once we hit MSRV 1.70` \
104-
-A clippy::manual_repeat_n `# to be removed once we hit MSRV 1.86` \
105-
-A clippy::io_other_error `# to be removed once we hit MSRV 1.74`
4+
5+
CLIPPY() {
6+
RUSTFLAGS='-D warnings' cargo clippy $1 -- $2 \
7+
`# Things clippy defaults to allowing but we should avoid` \
8+
-D clippy::clone_on_ref_ptr \
9+
`# Things where clippy is just wrong` \
10+
-A clippy::unwrap-or-default \
11+
-A clippy::upper_case_acronyms \
12+
`# Things where we do odd stuff on purpose ` \
13+
-A clippy::unusual_byte_groupings \
14+
-A clippy::unit_arg \
15+
`# Errors` \
16+
-A clippy::erasing_op \
17+
-A clippy::never_loop \
18+
`# Warnings` \
19+
-A renamed_and_removed_lints \
20+
-A clippy::blocks_in_conditions \
21+
-A clippy::borrow_deref_ref \
22+
-A clippy::clone_on_copy \
23+
-A clippy::collapsible_else_if \
24+
-A clippy::collapsible_if \
25+
-A clippy::collapsible_match \
26+
-A clippy::comparison_chain \
27+
-A clippy::doc_lazy_continuation \
28+
-A clippy::drain_collect \
29+
-A clippy::drop_non_drop \
30+
-A clippy::enum_variant_names \
31+
-A clippy::explicit_auto_deref \
32+
-A clippy::extra_unused_lifetimes \
33+
-A clippy::for_kv_map \
34+
-A clippy::from_over_into \
35+
-A clippy::get_first \
36+
-A clippy::identity_op \
37+
-A clippy::if_same_then_else \
38+
-A clippy::inconsistent_digit_grouping \
39+
-A clippy::iter_kv_map \
40+
-A clippy::iter_skip_next \
41+
-A clippy::large_enum_variant \
42+
-A clippy::legacy_numeric_constants \
43+
-A clippy::len_without_is_empty \
44+
-A clippy::len_zero \
45+
-A clippy::let_and_return \
46+
-A clippy::manual_div_ceil `# to be removed once we hit MSRV 1.73.0` \
47+
-A clippy::manual_filter \
48+
-A clippy::manual_map \
49+
-A clippy::manual_memcpy \
50+
-A clippy::manual_inspect \
51+
-A clippy::manual_range_contains \
52+
-A clippy::manual_range_patterns \
53+
-A clippy::manual_saturating_arithmetic \
54+
-A clippy::manual_strip \
55+
-A clippy::map_clone \
56+
-A clippy::map_flatten \
57+
-A clippy::match_like_matches_macro \
58+
-A clippy::match_ref_pats \
59+
-A clippy::multiple_bound_locations \
60+
-A clippy::mut_mutex_lock \
61+
-A clippy::needless_bool \
62+
-A clippy::needless_borrow \
63+
-A clippy::needless_borrowed_reference \
64+
-A clippy::needless_borrows_for_generic_args \
65+
-A clippy::needless_lifetimes \
66+
-A clippy::needless_question_mark \
67+
-A clippy::needless_range_loop \
68+
-A clippy::needless_return \
69+
-A clippy::new_without_default \
70+
-A clippy::non_minimal_cfg \
71+
-A clippy::op_ref \
72+
-A clippy::option_as_ref_deref \
73+
-A clippy::option_map_or_none \
74+
-A clippy::option_map_unit_fn \
75+
-A clippy::precedence \
76+
-A clippy::ptr_arg \
77+
-A clippy::question_mark \
78+
-A clippy::readonly_write_lock \
79+
-A clippy::redundant_closure \
80+
-A clippy::redundant_field_names \
81+
-A clippy::redundant_guards \
82+
-A clippy::redundant_pattern_matching \
83+
-A clippy::redundant_slicing \
84+
-A clippy::redundant_static_lifetimes \
85+
-A clippy::result_large_err \
86+
-A clippy::result_unit_err \
87+
-A clippy::search_is_some \
88+
-A clippy::single_char_pattern \
89+
-A clippy::single_match \
90+
-A clippy::slow_vector_initialization \
91+
-A clippy::tabs_in_doc_comments \
92+
-A clippy::to_string_in_format_args \
93+
-A clippy::too_many_arguments \
94+
-A clippy::toplevel_ref_arg \
95+
-A clippy::type_complexity \
96+
-A clippy::unnecessary_cast \
97+
-A clippy::unnecessary_get_then_check \
98+
-A clippy::unnecessary_lazy_evaluations \
99+
-A clippy::unnecessary_mut_passed \
100+
-A clippy::unnecessary_sort_by \
101+
-A clippy::unnecessary_to_owned \
102+
-A clippy::unnecessary_unwrap \
103+
-A clippy::unused_unit \
104+
-A clippy::useless_conversion \
105+
-A clippy::unnecessary_map_or `# to be removed once we hit MSRV 1.70` \
106+
-A clippy::manual_repeat_n `# to be removed once we hit MSRV 1.86` \
107+
-A clippy::io_other_error `# to be removed once we hit MSRV 1.74`
108+
}
109+
110+
CLIPPY
111+
# We allow some additional warnings in tests which we should fix, but which aren't currently a priority
112+
CLIPPY --tests "-A clippy::bool_assert_comparison -A clippy::assertions_on_constants -A clippy::needless-late-init -A clippy::field_reassign_with_default -A clippy::unnecessary_literal_unwrap -A clippy::useless_vec"

0 commit comments

Comments
 (0)