Skip to content

Most commonly ignored lints #5418

Closed
Closed
@dtolnay

Description

@dtolnay

I collected some data from https://grep.app on which Clippy lints are needing to be suppressed most commonly in the wild. This is based on number of results for this regex:

\[allow\(.*clippy::LINT_NAME\b

which is an approximation but useful. Example query

Clippy's most severe flaw in my experience has been low-signal lints that are enabled by default, aren't worth resolving and commonly need to be suppressed. Hopefully this gives some data to support deleting or downgrading many of those lints to pedantic opt-in lints.

In the table below, I would recommend paying attention to the style and perf lints. On style, highly suppressed style lints indicate that the community has consciously decided that Clippy's opinion on style is wrong. On perf, highly suppressed lints indicate that the community does not consider it valuable to make their code more obtuse for the sake of questionable alleged performance. I think it would be wise to delete or downgrade many of these.


Here is the distribution by lint of how many times lints are suppressed. As expected, most lints are rarely suppressed, but there are a dozen or so lints that are very commonly suppressed.


And here are the top most commonly ignored lints. I'll cross off lints as I delete or downgrade them.

ignored lint name category
432 cognitive_complexity complexity
421 too_many_arguments complexity
312 type_complexity complexity
259 large_enum_variant perf
201 unreadable_literal style
193 new_ret_no_self style
184 cast_ptr_alignment correctness
178 trivially_copy_pass_by_ref perf
148 new_without_default style
141 needless_pass_by_value style
128 float_cmp correctness
125 many_single_char_names style
102 redundant_closure style
85 identity_op complexity
84 should_implement_trait style
83 module_inception style
74 wrong_self_convention style
65 needless_range_loop style
63 len_without_is_empty style
63 mutex_atomic perf
59 missing_safety_doc style
57 needless_doctest_main style
56 ptr_arg style
51 let_and_return style
50 mut_from_ref correctness
47 single_match style
46 unnecessary_operation complexity
45 enum_variant_names style
38 let_unit_value style
38 suspicious_arithmetic_impl correctness
37 never_loop correctness
37 unit_arg complexity
36 derive_hash_xor_eq correctness
36 needless_return style
36 no_effect complexity
36 option_option complexity
34 match_ref_pats style
32 if_same_then_else correctness
32 redundant_clone perf
31 collapsible_if style
31 implicit_hasher style
31 needless_lifetimes complexity
28 identity_conversion complexity
26 blacklisted_name style
26 borrowed_box complexity
25 eq_op correctness
25 useless_let_if_seq style
24 excessive_precision style
23 comparison_chain style
22 map_entry perf
22 match_wild_err_arm style
22 transmute_ptr_to_ptr complexity
21 redundant_field_names style
20 inconsistent_digit_grouping style
20 match_bool style
20 not_unsafe_ptr_arg_deref correctness

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-categoryArea: Categorization of lintsC-tracking-issueCategory: Tracking IssueS-needs-discussionStatus: Needs further discussion before merging or work can be started

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions