Skip to content

Commit 2f508d6

Browse files
authored
Replace cargo-cranky with workspace lints (#4413)
Replace `cargo-cranky` (which has served us well) with workspace lints
1 parent cee7906 commit 2f508d6

File tree

82 files changed

+348
-289
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+348
-289
lines changed

.github/pull_request_template.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Please read the "Making a PR" section of [`CONTRIBUTING.md`](https://github.com/
66
* If applicable, add a screenshot or gif.
77
* If it is a non-trivial addition, consider adding a demo for it to `egui_demo_lib`, or a new example.
88
* Do NOT open PR:s from your `master` branch, as that makes it hard for maintainers to add commits to your PR.
9-
* Remember to run `cargo fmt` and `cargo cranky`.
9+
* Remember to run `cargo fmt` and `cargo clippy`.
1010
* Open the PR as a draft until you have self-reviewed it and run `./scripts/check.sh`.
1111
* When you have addressed a PR comment, mark it as resolved.
1212

.github/workflows/rust.yml

+5-15
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,6 @@ jobs:
4040
- name: Lint vertical spacing
4141
run: ./scripts/lint.py
4242

43-
- name: Install cargo-cranky
44-
uses: baptiste0928/cargo-install@v1
45-
with:
46-
crate: cargo-cranky
47-
4843
- name: check --all-features
4944
run: cargo check --locked --all-features --all-targets
5045

@@ -78,11 +73,11 @@ jobs:
7873
- name: Test
7974
run: cargo test --all-features
8075

81-
- name: Cranky
82-
run: cargo cranky --all-targets --all-features -- -D warnings
76+
- name: clippy
77+
run: cargo clippy --all-targets --all-features -- -D warnings
8378

84-
- name: Cranky release
85-
run: cargo cranky --all-targets --all-features --release -- -D warnings
79+
- name: clippy release
80+
run: cargo clippy --all-targets --all-features --release -- -D warnings
8681

8782
# ---------------------------------------------------------------------------
8883

@@ -101,11 +96,6 @@ jobs:
10196
- name: Set up cargo cache
10297
uses: Swatinem/rust-cache@v2
10398

104-
- name: Install cargo-cranky
105-
uses: baptiste0928/cargo-install@v1
106-
with:
107-
crate: cargo-cranky
108-
10999
- name: Check wasm32 egui_demo_app
110100
run: cargo check -p egui_demo_app --lib --target wasm32-unknown-unknown
111101

@@ -122,7 +112,7 @@ jobs:
122112

123113
- run: ./scripts/wasm_bindgen_check.sh --skip-setup
124114

125-
- name: Cranky wasm32
115+
- name: clippy wasm32
126116
run: ./scripts/clippy_wasm.sh
127117

128118
# ---------------------------------------------------------------------------

Cargo.toml

+166
Original file line numberDiff line numberDiff line change
@@ -84,3 +84,169 @@ wgpu = { version = "0.19.1", default-features = false, features = [
8484
"fragile-send-sync-non-atomic-wasm",
8585
] }
8686
winit = { version = "0.29.4", default-features = false }
87+
88+
89+
[workspace.lints.rust]
90+
unsafe_code = "deny"
91+
92+
elided_lifetimes_in_paths = "warn"
93+
future_incompatible = "warn"
94+
nonstandard_style = "warn"
95+
rust_2018_idioms = "warn"
96+
rust_2021_prelude_collisions = "warn"
97+
semicolon_in_expressions_from_macros = "warn"
98+
trivial_numeric_casts = "warn"
99+
unsafe_op_in_unsafe_fn = "warn" # `unsafe_op_in_unsafe_fn` may become the default in future Rust versions: https://github.com/rust-lang/rust/issues/71668
100+
unused_extern_crates = "warn"
101+
unused_import_braces = "warn"
102+
unused_lifetimes = "warn"
103+
104+
trivial_casts = "allow"
105+
unused_qualifications = "allow"
106+
107+
[workspace.lints.rustdoc]
108+
all = "warn"
109+
missing_crate_level_docs = "warn"
110+
111+
# See also clippy.toml
112+
[workspace.lints.clippy]
113+
as_ptr_cast_mut = "warn"
114+
await_holding_lock = "warn"
115+
bool_to_int_with_if = "warn"
116+
char_lit_as_u8 = "warn"
117+
checked_conversions = "warn"
118+
clear_with_drain = "warn"
119+
cloned_instead_of_copied = "warn"
120+
dbg_macro = "warn"
121+
debug_assert_with_mut_call = "warn"
122+
derive_partial_eq_without_eq = "warn"
123+
disallowed_macros = "warn" # See clippy.toml
124+
disallowed_methods = "warn" # See clippy.toml
125+
disallowed_names = "warn" # See clippy.toml
126+
disallowed_script_idents = "warn" # See clippy.toml
127+
disallowed_types = "warn" # See clippy.toml
128+
doc_link_with_quotes = "warn"
129+
doc_markdown = "warn"
130+
empty_enum = "warn"
131+
enum_glob_use = "warn"
132+
equatable_if_let = "warn"
133+
exit = "warn"
134+
expl_impl_clone_on_copy = "warn"
135+
explicit_deref_methods = "warn"
136+
explicit_into_iter_loop = "warn"
137+
explicit_iter_loop = "warn"
138+
fallible_impl_from = "warn"
139+
filter_map_next = "warn"
140+
flat_map_option = "warn"
141+
float_cmp_const = "warn"
142+
fn_params_excessive_bools = "warn"
143+
fn_to_numeric_cast_any = "warn"
144+
from_iter_instead_of_collect = "warn"
145+
get_unwrap = "warn"
146+
if_let_mutex = "warn"
147+
implicit_clone = "warn"
148+
implied_bounds_in_impls = "warn"
149+
imprecise_flops = "warn"
150+
index_refutable_slice = "warn"
151+
inefficient_to_string = "warn"
152+
infinite_loop = "warn"
153+
into_iter_without_iter = "warn"
154+
invalid_upcast_comparisons = "warn"
155+
iter_not_returning_iterator = "warn"
156+
iter_on_empty_collections = "warn"
157+
iter_on_single_items = "warn"
158+
iter_without_into_iter = "warn"
159+
large_digit_groups = "warn"
160+
large_include_file = "warn"
161+
large_stack_arrays = "warn"
162+
large_stack_frames = "warn"
163+
large_types_passed_by_value = "warn"
164+
let_unit_value = "warn"
165+
linkedlist = "warn"
166+
lossy_float_literal = "warn"
167+
macro_use_imports = "warn"
168+
manual_assert = "warn"
169+
manual_clamp = "warn"
170+
manual_instant_elapsed = "warn"
171+
manual_let_else = "warn"
172+
manual_ok_or = "warn"
173+
manual_string_new = "warn"
174+
map_err_ignore = "warn"
175+
map_flatten = "warn"
176+
map_unwrap_or = "warn"
177+
match_on_vec_items = "warn"
178+
match_same_arms = "warn"
179+
match_wild_err_arm = "warn"
180+
match_wildcard_for_single_variants = "warn"
181+
mem_forget = "warn"
182+
mismatched_target_os = "warn"
183+
mismatching_type_param_order = "warn"
184+
missing_enforced_import_renames = "warn"
185+
missing_errors_doc = "warn"
186+
missing_safety_doc = "warn"
187+
mut_mut = "warn"
188+
mutex_integer = "warn"
189+
needless_borrow = "warn"
190+
needless_continue = "warn"
191+
needless_for_each = "warn"
192+
needless_pass_by_ref_mut = "warn"
193+
needless_pass_by_value = "warn"
194+
negative_feature_names = "warn"
195+
nonstandard_macro_braces = "warn"
196+
option_option = "warn"
197+
path_buf_push_overwrite = "warn"
198+
ptr_as_ptr = "warn"
199+
ptr_cast_constness = "warn"
200+
pub_without_shorthand = "warn"
201+
rc_mutex = "warn"
202+
readonly_write_lock = "warn"
203+
redundant_type_annotations = "warn"
204+
ref_option_ref = "warn"
205+
ref_patterns = "warn"
206+
rest_pat_in_fully_bound_structs = "warn"
207+
same_functions_in_if_condition = "warn"
208+
semicolon_if_nothing_returned = "warn"
209+
single_match_else = "warn"
210+
str_to_string = "warn"
211+
string_add = "warn"
212+
string_add_assign = "warn"
213+
string_lit_as_bytes = "warn"
214+
string_lit_chars_any = "warn"
215+
string_to_string = "warn"
216+
suspicious_command_arg_space = "warn"
217+
suspicious_xor_used_as_pow = "warn"
218+
todo = "warn"
219+
trailing_empty_array = "warn"
220+
trait_duplication_in_bounds = "warn"
221+
tuple_array_conversions = "warn"
222+
unchecked_duration_subtraction = "warn"
223+
undocumented_unsafe_blocks = "warn"
224+
unimplemented = "warn"
225+
uninhabited_references = "warn"
226+
uninlined_format_args = "warn"
227+
unnecessary_box_returns = "warn"
228+
unnecessary_safety_doc = "warn"
229+
unnecessary_struct_initialization = "warn"
230+
unnecessary_wraps = "warn"
231+
unnested_or_patterns = "warn"
232+
unused_peekable = "warn"
233+
unused_rounding = "warn"
234+
unused_self = "warn"
235+
useless_transmute = "warn"
236+
verbose_file_reads = "warn"
237+
wildcard_dependencies = "warn"
238+
zero_sized_map_values = "warn"
239+
240+
# TODO(emilk): enable more of these linits:
241+
iter_over_hash_type = "allow"
242+
let_underscore_untyped = "allow"
243+
missing_assert_message = "allow"
244+
print_stderr = "allow" # TODO(emilk): use `log` crate insteaditer_over_hash_type = "allow"
245+
should_panic_without_expect = "allow"
246+
too_many_lines = "allow"
247+
unwrap_used = "allow" # TODO(emilk): We really wanna warn on this one
248+
249+
manual_range_contains = "allow" # this one is just worse imho
250+
self_named_module_files = "allow" # Disabled waiting on https://github.com/rust-lang/rust-clippy/issues/9602
251+
significant_drop_tightening = "allow" # Too many false positives
252+
wildcard_imports = "allow" # we do this a lot in egui

0 commit comments

Comments
 (0)