Skip to content

Commit 2f53d9b

Browse files
emilkclaude
andauthored
Enable the clippy::pedantic lint group (#255)
Instead of opting in to pedantic lints one by one, enable the whole group and opt out of the noisy ones, mirroring emilk/egui#8429. Lints that were already enabled here one-by-one stay enabled, so this only adds coverage. Each opt-out carries its hit count, so the cost of turning one back on is visible. The one new hit outside the opt-out list (`if_not_else` in `span.rs`) is fixed here. * [x] I have followed the instructions in the PR template Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent c31b617 commit 2f53d9b

2 files changed

Lines changed: 30 additions & 97 deletions

File tree

Cargo.toml

Lines changed: 27 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -111,207 +111,140 @@ missing_crate_level_docs = "warn"
111111
# See also clippy.toml
112112
[workspace.lints.clippy]
113113
all = { level = "warn", priority = -1 }
114+
pedantic = { level = "warn", priority = -1 }
114115

115116
allow_attributes = "warn"
116117
as_ptr_cast_mut = "warn"
117118
await_holding_lock = "warn"
118-
bool_to_int_with_if = "warn"
119119
branches_sharing_code = "warn"
120-
cast_possible_wrap = "warn"
121120
char_lit_as_u8 = "warn"
122-
checked_conversions = "warn"
123121
clear_with_drain = "warn"
124122
clone_on_ref_ptr = "warn"
125-
cloned_instead_of_copied = "warn"
126123
coerce_container_to_any = "warn"
127-
comparison_chain = "warn"
128124
dbg_macro = "warn"
129125
debug_assert_with_mut_call = "warn"
130-
decimal_bitwise_operands = "warn"
131126
default_union_representation = "warn"
132127
derive_partial_eq_without_eq = "warn"
133128
disallowed_macros = "warn" # See clippy.toml
134129
disallowed_methods = "warn" # See clippy.toml
135130
disallowed_names = "warn" # See clippy.toml
136131
disallowed_script_idents = "warn" # See clippy.toml
137132
disallowed_types = "warn" # See clippy.toml
138-
doc_broken_link = "warn"
139-
doc_comment_double_space_linebreaks = "warn"
140133
doc_include_without_cfg = "warn"
141-
doc_link_with_quotes = "warn"
142-
doc_markdown = "warn"
143-
duration_suboptimal_units = "warn"
144-
elidable_lifetime_names = "warn"
145134
empty_enum_variants_with_brackets = "warn"
146-
empty_enums = "warn"
147135
empty_line_after_outer_attr = "warn"
148-
enum_glob_use = "warn"
149136
equatable_if_let = "warn"
150137
exit = "warn"
151-
expl_impl_clone_on_copy = "warn"
152-
explicit_deref_methods = "warn"
153-
explicit_into_iter_loop = "warn"
154-
explicit_iter_loop = "warn"
155138
expect_used = "warn"
156139
fallible_impl_from = "warn"
157-
filter_map_next = "warn"
158-
flat_map_option = "warn"
159140
float_cmp_const = "warn"
160-
fn_params_excessive_bools = "warn"
161141
fn_to_numeric_cast_any = "warn"
162-
format_push_string = "warn"
163-
from_iter_instead_of_collect = "warn"
164142
get_unwrap = "warn"
165143
if_let_mutex = "warn"
166-
ignore_without_reason = "warn"
167-
ignored_unit_patterns = "warn"
168-
implicit_clone = "warn"
169144
implied_bounds_in_impls = "warn"
170145
imprecise_flops = "warn"
171-
inconsistent_struct_constructor = "warn"
172-
index_refutable_slice = "warn"
173-
inefficient_to_string = "warn"
174146
infinite_loop = "warn"
175-
into_iter_without_iter = "warn"
176-
invalid_upcast_comparisons = "warn"
177-
ip_constant = "warn"
178-
iter_filter_is_ok = "warn"
179-
iter_filter_is_some = "warn"
180-
iter_not_returning_iterator = "warn"
181147
iter_on_empty_collections = "warn"
182148
iter_on_single_items = "warn"
183149
iter_over_hash_type = "warn"
184-
iter_without_into_iter = "warn"
185-
large_digit_groups = "warn"
186-
large_futures = "warn"
187150
large_include_file = "warn"
188-
large_stack_arrays = "warn"
189151
large_stack_frames = "warn"
190-
large_types_passed_by_value = "warn"
191152
let_underscore_must_use = "warn"
192153
let_underscore_untyped = "warn"
193154
let_unit_value = "warn"
194-
linkedlist = "warn"
195155
literal_string_with_formatting_args = "warn"
196156
lossy_float_literal = "warn"
197-
macro_use_imports = "warn"
198-
manual_assert = "warn"
199157
manual_clamp = "warn"
200158
manual_ilog2 = "warn"
201-
manual_instant_elapsed = "warn"
202-
manual_is_power_of_two = "warn"
203-
manual_is_variant_and = "warn"
204-
manual_let_else = "warn"
205-
manual_midpoint = "warn"
206159
manual_ok_or = "warn"
207-
manual_string_new = "warn"
208160
map_err_ignore = "warn"
209161
map_flatten = "warn"
210-
match_bool = "warn"
211-
match_same_arms = "warn"
212-
match_wild_err_arm = "warn"
213-
match_wildcard_for_single_variants = "warn"
214162
mem_forget = "warn"
215-
mismatching_type_param_order = "warn"
216163
missing_assert_message = "warn"
217164
missing_enforced_import_renames = "warn"
218-
missing_errors_doc = "warn"
219-
missing_fields_in_debug = "warn"
220165
missing_safety_doc = "warn"
221166
mixed_attributes_style = "warn"
222-
mut_mut = "warn"
223167
mutex_integer = "warn"
224168
needless_borrow = "warn"
225-
needless_continue = "warn"
226-
needless_for_each = "warn"
227169
needless_pass_by_ref_mut = "warn"
228-
needless_pass_by_value = "warn"
229-
needless_raw_string_hashes = "warn"
230170
needless_type_cast = "warn"
231171
negative_feature_names = "warn"
232-
non_std_lazy_statics = "warn"
233172
non_zero_suggestions = "warn"
234173
nonstandard_macro_braces = "warn"
235174
only_used_in_recursion = "warn"
236-
option_as_ref_cloned = "warn"
237-
option_option = "warn"
238175
or_fun_call = "warn"
239176
path_buf_push_overwrite = "warn"
240177
pathbuf_init_then_push = "warn"
241178
precedence_bits = "warn"
242179
print_stderr = "warn"
243180
print_stdout = "warn"
244-
ptr_as_ptr = "warn"
245-
ptr_cast_constness = "warn"
246-
pub_underscore_fields = "warn"
247181
pub_without_shorthand = "warn"
248182
rc_mutex = "warn"
249183
readonly_write_lock = "warn"
250184
redundant_type_annotations = "warn"
251-
ref_as_ptr = "warn"
252-
ref_option = "warn"
253-
ref_option_ref = "warn"
254185
ref_patterns = "warn"
255186
rest_pat_in_fully_bound_structs = "warn"
256187
return_and_then = "warn"
257-
same_functions_in_if_condition = "warn"
258-
same_length_and_capacity = "warn"
259-
self_only_used_in_recursion = "warn"
260-
semicolon_if_nothing_returned = "warn"
261188
set_contains_or_insert = "warn"
262-
should_panic_without_expect = "warn"
263-
single_char_pattern = "warn"
264-
single_match_else = "warn"
265189
single_option_map = "warn"
266-
str_split_at_newline = "warn"
267190
str_to_string = "warn"
268191
string_add = "warn"
269-
string_add_assign = "warn"
270192
string_lit_as_bytes = "warn"
271193
string_lit_chars_any = "warn"
272194
suspicious_command_arg_space = "warn"
273195
suspicious_xor_used_as_pow = "warn"
274196
todo = "warn"
275197
too_long_first_doc_paragraph = "warn"
276198
too_many_arguments = "warn"
277-
too_many_lines = "warn"
278199
trailing_empty_array = "warn"
279200
trait_duplication_in_bounds = "warn"
280-
transmute_ptr_to_ptr = "warn"
281201
tuple_array_conversions = "warn"
282-
unchecked_time_subtraction = "warn"
283202
undocumented_unsafe_blocks = "warn"
284203
unimplemented = "warn"
285204
uninhabited_references = "warn"
286-
uninlined_format_args = "warn"
287-
unnecessary_box_returns = "warn"
288-
unnecessary_debug_formatting = "warn"
289-
unnecessary_literal_bound = "warn"
290205
unnecessary_safety_comment = "warn"
291206
unnecessary_safety_doc = "warn"
292207
unnecessary_self_imports = "warn"
293-
unnecessary_semicolon = "warn"
294208
unnecessary_struct_initialization = "warn"
295-
unnecessary_trailing_comma = "warn"
296-
unnecessary_wraps = "warn"
297-
unnested_or_patterns = "warn"
298-
unused_async = "warn"
299209
unused_peekable = "warn"
300210
unused_rounding = "warn"
301-
unused_self = "warn"
302211
unused_trait_names = "warn"
303212
unwrap_used = "warn"
304213
use_self = "warn"
305214
useless_let_if_seq = "warn"
306215
useless_transmute = "warn"
307216
verbose_file_reads = "warn"
308217
wildcard_dependencies = "warn"
309-
wildcard_imports = "warn"
310-
zero_sized_map_values = "warn"
311218

219+
# Pedantic lints we opt out of, with the number of hits at the time we enabled `pedantic`.
220+
# Lints that were already enabled here one-by-one are kept on.
221+
cast_lossless = "allow" # 57 hits
222+
cast_possible_truncation = "allow" # 36 hits
223+
cast_precision_loss = "allow" # 38 hits
224+
cast_sign_loss = "allow" # 9 hits
225+
default_trait_access = "allow" # 12 hits
226+
float_cmp = "allow" # exact float comparisons are usually intentional (`float_cmp_const` is still on)
227+
inline_always = "allow" # we know what we are doing
228+
items_after_statements = "allow" # 3 hits
229+
many_single_char_names = "allow" # `r, g, b, a` and `h, s, v` are fine
230+
missing_panics_doc = "allow" # 2 hits
231+
must_use_candidate = "allow" # 181 hits
232+
redundant_closure_for_method_calls = "allow" # 13 hits
233+
return_self_not_must_use = "allow" # 194 hits
234+
similar_names = "allow" # too many false positives, e.g. `encoder`/`encoded`
235+
struct_excessive_bools = "allow" # 3 hits
236+
struct_field_names = "allow" # 3 hits
237+
trivially_copy_pass_by_ref = "allow" # 3 hits
238+
unreadable_literal = "allow"
239+
used_underscore_binding = "allow"
240+
241+
# These are meh:
312242
assigning_clones = "allow" # No please
313243
manual_range_contains = "allow" # this one is just worse imho
314244
map_unwrap_or = "allow" # so is this one
245+
246+
# NOTE: these are in `restriction`/`nursery`, so the `allow` is a no-op today.
247+
# We keep them to record our intent in case we ever enable those groups.
315248
self_named_module_files = "allow" # Disabled waiting on https://github.com/rust-lang/rust-clippy/issues/9602
316249
significant_drop_tightening = "allow" # Too many false positives
317250

egui_plot/src/items/span.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -294,10 +294,10 @@ impl PlotItem for Span {
294294
fn initialize(&mut self, _x_range: RangeInclusive<f64>) {}
295295

296296
fn color(&self) -> Color32 {
297-
if self.fill != Color32::TRANSPARENT {
298-
self.fill
299-
} else {
297+
if self.fill == Color32::TRANSPARENT {
300298
self.border_stroke.color
299+
} else {
300+
self.fill
301301
}
302302
}
303303

0 commit comments

Comments
 (0)