Skip to content

Commit d5f3f08

Browse files
committed
Use cargo cranky
cargo cranky (https://github.com/ericseppanen/cargo-cranky) is a new tool that passes lints specified in a Cranky.toml to cargo clippy. This is a possible solution to rust-lang/cargo#5034
1 parent 5a4dd36 commit d5f3f08

File tree

4 files changed

+114
-106
lines changed

4 files changed

+114
-106
lines changed

.cargo/config.toml

-100
This file was deleted.

.github/workflows/rust.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@ jobs:
9292
command: fmt
9393
args: --all -- --check
9494

95-
clippy:
96-
name: Clippy
95+
cranky:
96+
name: cargo cranky
9797
runs-on: ubuntu-latest
9898
steps:
9999
- uses: actions/checkout@v2
@@ -103,11 +103,11 @@ jobs:
103103
toolchain: 1.62.0
104104
override: true
105105
- run: sudo apt-get update && sudo apt-get install libgtk-3-dev
106-
- run: rustup component add clippy
106+
- run: cargo install cargo-cranky
107107
- uses: actions-rs/cargo@v1
108108
with:
109-
command: clippy
110-
args: --all-features -- -D warnings
109+
command: cranky
110+
args: --workspace --all-targets --all-features -- -D warnings
111111

112112
cargo-deny:
113113
name: cargo deny

Cranky.toml

+106
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
# https://github.com/ericseppanen/cargo-cranky
2+
# cargo install cargo-cranky && cargo cranky
3+
4+
deny = [
5+
"unsafe_code",
6+
]
7+
8+
warn = [
9+
"clippy::all",
10+
"clippy::await_holding_lock",
11+
"clippy::char_lit_as_u8",
12+
"clippy::checked_conversions",
13+
"clippy::dbg_macro",
14+
"clippy::debug_assert_with_mut_call",
15+
"clippy::disallowed_methods",
16+
"clippy::disallowed_script_idents",
17+
"clippy::doc_markdown",
18+
"clippy::empty_enum",
19+
"clippy::enum_glob_use",
20+
"clippy::equatable_if_let",
21+
"clippy::exit",
22+
"clippy::expl_impl_clone_on_copy",
23+
"clippy::explicit_deref_methods",
24+
"clippy::explicit_into_iter_loop",
25+
"clippy::fallible_impl_from",
26+
"clippy::filter_map_next",
27+
"clippy::flat_map_option",
28+
"clippy::float_cmp_const",
29+
"clippy::fn_params_excessive_bools",
30+
"clippy::fn_to_numeric_cast_any",
31+
"clippy::from_iter_instead_of_collect",
32+
"clippy::if_let_mutex",
33+
"clippy::implicit_clone",
34+
"clippy::imprecise_flops",
35+
"clippy::index_refutable_slice",
36+
"clippy::inefficient_to_string",
37+
"clippy::invalid_upcast_comparisons",
38+
"clippy::iter_not_returning_iterator",
39+
"clippy::large_digit_groups",
40+
"clippy::large_stack_arrays",
41+
"clippy::large_types_passed_by_value",
42+
"clippy::let_unit_value",
43+
"clippy::linkedlist",
44+
"clippy::lossy_float_literal",
45+
"clippy::macro_use_imports",
46+
"clippy::manual_ok_or",
47+
"clippy::map_err_ignore",
48+
"clippy::map_flatten",
49+
"clippy::map_unwrap_or",
50+
"clippy::match_on_vec_items",
51+
"clippy::match_same_arms",
52+
"clippy::match_wild_err_arm",
53+
"clippy::match_wildcard_for_single_variants",
54+
"clippy::mem_forget",
55+
"clippy::mismatched_target_os",
56+
"clippy::missing_enforced_import_renames",
57+
"clippy::missing_safety_doc",
58+
"clippy::mut_mut",
59+
"clippy::mutex_integer",
60+
"clippy::needless_borrow",
61+
"clippy::needless_continue",
62+
"clippy::needless_for_each",
63+
"clippy::needless_pass_by_value",
64+
"clippy::negative_feature_names",
65+
"clippy::nonstandard_macro_braces",
66+
"clippy::option_option",
67+
"clippy::path_buf_push_overwrite",
68+
"clippy::ptr_as_ptr",
69+
"clippy::rc_mutex",
70+
"clippy::ref_option_ref",
71+
"clippy::rest_pat_in_fully_bound_structs",
72+
"clippy::same_functions_in_if_condition",
73+
"clippy::semicolon_if_nothing_returned",
74+
"clippy::single_match_else",
75+
"clippy::str_to_string",
76+
"clippy::string_add_assign",
77+
"clippy::string_add",
78+
"clippy::string_lit_as_bytes",
79+
"clippy::string_to_string",
80+
"clippy::todo",
81+
"clippy::trailing_empty_array",
82+
"clippy::trait_duplication_in_bounds",
83+
"clippy::unimplemented",
84+
"clippy::unnecessary_wraps",
85+
"clippy::unnested_or_patterns",
86+
"clippy::unused_self",
87+
"clippy::useless_transmute",
88+
"clippy::verbose_file_reads",
89+
"clippy::zero_sized_map_values",
90+
"future_incompatible",
91+
"nonstandard_style",
92+
"rust_2018_idioms",
93+
"rustdoc::missing_crate_level_docs",
94+
"semicolon_in_expressions_from_macros",
95+
"trivial_numeric_casts",
96+
"unused_extern_crates",
97+
"unused_import_braces",
98+
# "clippy::cloned_instead_of_copied",
99+
# "clippy::missing_errors_doc",
100+
# "clippy::mod_module_files",
101+
# "trivial_casts",
102+
# "unused_qualifications",
103+
]
104+
105+
allow = [
106+
]

check.sh

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,16 @@
22
# This scripts runs various CI-like checks in a convenient way.
33
set -eux
44

5+
cargo install cargo-cranky # Uses lints defined in Cranky.toml. See https://github.com/ericseppanen/cargo-cranky
6+
57
RUSTFLAGS="-D warnings"
68
RUSTDOCFLAGS="-D warnings" # https://github.com/emilk/egui/pull/1454
79

810
cargo build --all-features
911
cargo check --workspace --all-targets --all-features
1012
cargo check -p re_viewer --all-features --lib --target wasm32-unknown-unknown
1113
cargo fmt --all -- --check
12-
cargo clippy --workspace --all-targets --all-features -- -D warnings -W clippy::all
14+
cargo cranky --workspace --all-targets --all-features -- -D warnings
1315
cargo test --workspace --all-targets --all-features
1416
cargo test --workspace --doc --all-features
1517

0 commit comments

Comments
 (0)