5c6fe68c00
new lint: `source_item_ordering` changelog: [`source_item_ordering`]: Introduced a new restriction lint that checks the ordering of items in Modules, Enums, Structs, Impls and Traits. From the written documentation: > Why restrict this? > Keeping a consistent ordering throughout the codebase helps with working as a team, and possibly improves maintainability of the codebase. The idea is that by defining a consistent and enforceable rule for how source files are structured, less time will be wasted during reviews on a topic that is (under most circumstances) not relevant to the logic implemented in the code. Sometimes this will be referred to as "bike-shedding". > > Keep in mind, that ordering source code alphabetically can lead to reduced performance in cases where the most commonly used enum variant isn't the first entry anymore, and similar optimizations that can reduce branch misses, cache locality and such. Either don't use this lint if that's relevant, or disable the lint in modules or items specifically where it matters. Other solutions can be to use profile guided optimization (PGO), or other advanced optimization methods. I tried to build it as configurable as possible, as such a highly opinionated lint should be adjustable to personal opinions. I'm open to any input and will be available both here and on the zulip for communication. In the meantime I'll be testing this lint against my own code-bases, which I've (manually) kept ordered with the default config, to see how well it works in practice. And lastly, a big thanks to the community for making clippy the best linter there is! |
||
---|---|---|
.. | ||
absolute_paths | ||
allow_mixed_uninlined_format_args | ||
arbitrary_source_item_ordering | ||
arithmetic_side_effects_allowed | ||
array_size_threshold | ||
await_holding_invalid_type | ||
bad_toml | ||
bad_toml_type | ||
borrow_interior_mutable_const | ||
conf_deprecated_key | ||
dbg_macro | ||
decimal_literal_representation | ||
declare_interior_mutable_const | ||
disallowed_macros | ||
disallowed_names_append | ||
disallowed_names_replace | ||
disallowed_script_idents | ||
doc_valid_idents_append | ||
doc_valid_idents_replace | ||
duplicated_keys | ||
duplicated_keys_deprecated | ||
duplicated_keys_deprecated_2 | ||
enum_variant_size | ||
excessive_nesting | ||
expect_used | ||
explicit_iter_loop | ||
extra_unused_type_parameters | ||
fn_params_excessive_bools | ||
functions_maxlines | ||
good_toml_no_false_negatives | ||
ifs_same_cond | ||
impl_trait_in_params | ||
invalid_min_rust_version | ||
item_name_repetitions | ||
large_futures | ||
large_include_file | ||
large_stack_frames | ||
large_types_passed_by_value | ||
lint_decimal_readability | ||
macro_metavars_in_unsafe | ||
manual_let_else | ||
max_suggested_slice_pattern_length | ||
min_ident_chars | ||
min_rust_version | ||
missing_enforced_import_rename | ||
module_inception | ||
modulo_arithmetic | ||
mut_key | ||
needless_pass_by_ref_mut | ||
needless_raw_string_hashes_one_allowed | ||
nonstandard_macro_braces | ||
panic | ||
path_ends_with_ext | ||
print_macro | ||
private-doc-errors | ||
pub_crate_missing_docs | ||
pub_underscore_fields | ||
renamed_function_params | ||
result_large_err | ||
semicolon_block | ||
strict_non_send_fields_in_send_ty | ||
struct_excessive_bools | ||
suppress_lint_in_const | ||
toml_disallow | ||
toml_disallowed_methods | ||
toml_disallowed_types | ||
toml_trivially_copy | ||
toml_unknown_key | ||
too_large_for_stack | ||
too_many_arguments | ||
type_complexity | ||
type_repetition_in_bounds | ||
undocumented_unsafe_blocks | ||
unnecessary_box_returns | ||
unwrap_used | ||
upper_case_acronyms_aggressive | ||
useless_vec | ||
vec_box_sized | ||
verbose_bit_mask | ||
wildcard_imports | ||
wildcard_imports_whitelist | ||
zero_single_char_names | ||
update-all-references.sh |