-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Open
Labels
S-needs-discussionStatus: Needs further discussion before merging or work can be startedStatus: Needs further discussion before merging or work can be started
Milestone
Description
RFC 344 mentions a naming convention for lints, and I think that going through the names of the lints clippy offers to be more consistent would be a good idea.
The full list of lints is here: https://rust-lang-nursery.github.io/rust-clippy/master/index.html
I'll be updating this as I go through the lints with what extra conventions on top of what RFC 344 offers should be added to help clippy create better lint names. :)
Lint rules:
- We should probably aim for a whitelist of starting words, just like how
unusedis used across Rust lints. For now, I can think ofincorrect,excessive,redundant,temporary, andundefinedas a few big keywords. - When describing statements or expressions that are explicitly checked, said constructs should be explained as closely to Rust syntax as possible, using
valas a placeholder for a variable name. - When describing values of a particular trait, the trait should be suffixed with
types. - When describing things happening in a function that is not properly annotated, these should be listed as
construct_in_XXX_function. - When describing lints, describe the lint rather than the intent.
- When describing UB, start with
undefined. - Use nouns rather than shortenings of words whenever possible.
- When describing rust syntax in lints, don't go overboard and separate out lints that should be together.
Lint changes:
almost_swapped, following rule 1, should beincorrect_swapsapprox_constantshould beapproximate_known_constantsassign_op_patterndefinitely should have a different name but I'm not sure whatborrowed_boxshould be renamed toredundant_boxesand include other lints likeboxed_localfor_loop_over_optionandfor_loop_over_result, following rules 2 and 8, should befor_val_in_optioniter_next_loop, following rule 2, should befor_val_in_iter_nextdeprecated_semvershould benon_semver_deprecations, because rather thandrop_copy, following rule 3, should bedrop_copy_typesnot_unsafe_ptr_arg_deref, following rule 4, should bederef_ptr_arg_in_safe_functionslogic_bugshould explain what it's linting and be renamed tounused_short_circuitspossible_missing_comma, by rule 5, should be renamed tomultiline_binops_in_arraywrong_transmute, by rule 6, should beundefined_transmutesinvalid_regex, by rule 1, should beincorrect_regexesmin_max, following rule 1, should beincorrect_clampsunit_cmpshould beunit_comparisonsby 7reverse_range_loop, by 1 should beincorrect_reversed_rangessuspicious_arithmetic_implby 5 should beincorrect_op_in_impl_opsuspicious_op_assign_implby 5 should beincorrect_op_in_impl_op_assign, or combined withincorrect_op_in_impl_opfloat_cmpshould befloat_comparisonsby 7zero_width_spaceshould bezero_width_spacesfn_to_numeric_cast_with_truncationshould betruncating_fn_ptr_as_intby 2while_immutable_conditionshould bewhile_immutable_valby 2never_loopshould beinfinite_loopsinfinite_itershould beinfinite_loops, unless we're still not sure about the quality ofnever_loopand want to add aninfinite_iter_loopsin the meantimenonsensical_open_optionsshould beunused_file_optionsforget_copyshould beforget_copy_typesif_same_then_elseandifs_same_condshould be combined intounused_ifcast_ptr_alignmentshould beincorrectly_aligned_ptr_castsmodulo_one,erasing_op,ineffective_bit_maskshould be combined intounused_operationsinline_fn_without_bodyshould beempty_inline_fnmut_from_refshould bereturning_mut_ref_from_refinvalid_refshould beundefined_referencesserde_api_misuseprobably needs a different name but idk what it should bematch_boolshould bematch_bool_typescmp_nullshould benull_comparisonswrite_with_newlineandprint_with_newlineshould beprint_val_newlineunneeded_field_patternshould beunused_field_patternsnew_without_default_derivemight need a new name or rulezero_ptrshould bezero_as_ptrwrong_self_conventionshould beincorrect_self_conventionsinconsistent_digit_groupingshould beinconsistent_digit_groupsto matchlarge_digit_groupsrange_minus_oneshould beinclusive_ranges_to_val_minus_one(I don't like how long it is, but I can't think of anything better?)regex_macroshould beincorrect_regex_macro_callsop_refshould bereferencing_comparisonsquestion_markshould beincorrect_triesredundant_closureshould beunused_closuresptr_argshould besmart_ptr_argumentschars_last_cmpshould bechars_last_eq_charblacklisted_nameshould beblacklisted_namesdouble_negshould bedouble_negationsunnecessary_foldshould beunspecialized_foldslet_unit_valueshould beunit_variablesneedless_range_loopshould beredundant_index_loopsexcessive_precisionshould beexcessive_precision_float_literalsduplicate_underscore_argumentshould bedouble_underscore_argumentspanic_paramsshould bemissing_panic_argumentswriteln_empty_stringshould be part ofprintln_empty_stringinfallible_destructuring_matchshould be part ofinfalliable_matchesblock_in_if_condition_stmtshould bestatements_in_if_conditionsunreadable_literalshould beunreadable_literalsunsafe_removed_from_nameshould beimport_unsafe_as_safebuiltin_type_shadowshould bebuiltin_type_shadowingneg_multiplyshould betimes_negative_oneconst_static_lifetimeshould beunused_static_lifetimesexplicit_iter_loopshould beexplicit_forsingle_matchshould beexplicit_if_letfor_kv_mapshould beexcessive_entry_iterators
oli-obk, Manishearth, flip1995, goodmanjonathan, maxencefrenette and 2 more
Metadata
Metadata
Assignees
Labels
S-needs-discussionStatus: Needs further discussion before merging or work can be startedStatus: Needs further discussion before merging or work can be started