All notable changes to this project will be documented in this file. See Changelog Update if you want to update this document.
Current stable, released 2024-09-05
cfg_not_test
to restriction
#11293byte_char_slices
to style
#10155set_contains_or_insert
to nursery
#12873manual_rotate
to style
#12983unnecessary_min_or_max
to complexity
#12368manual_inspect
to complexity
#12287field_scoped_visibility_modifiers
to restriction
#12893manual_pattern_char_comparison
to style
#12849needless_maybe_sized
to suspicious
#10632needless_character_iteration
to suspicious
#12815allow_attributes
, allow_attributes_without_reason
: Now work on stable rust#120924overflow_check_conditional
to panicking_overflow_checks
#12944panicking_overflow_checks
to correctness
(From complexity
now deny-by-default) #12944thread_local_initializer_can_be_made_const
to missing_const_for_thread_local
#12974maybe_misused_cfg
and mismatched_target_os
as they are now caught by cargo and rustc #12875significant_drop_in_scrutinee
: Now also checks scrutinies of while let
and for let
expressions #12870std_instead_of_core
: Now respects the msrv
configuration #13168suboptimal_flops
: No longer crashes on custom .log()
functions #12884Current stable, released 2024-07-25
View all 68 merged pull requests
while_float
to nursery
#12765macro_metavars_in_unsafe
to suspicious
#12107renamed_function_params
to restriction
#11540doc_lazy_continuation
to style
#12770assigning_clones
to pedantic
(From perf
now allow-by-default) #12779single_char_pattern
to pedantic
(From perf
now allow-by-default) #11852panic
: Added allow-panic-in-tests
configuration to allow the lint in tests #12803missing_const_for_fn
: Now respects the msrv
configuration #12713missing_panics_doc
: No longer lints on compile-time panics #12790collapsible_match
: Now considers the msrv
configuration for the suggestion #12745useless_vec
: Added allow-useless-vec-in-tests
configuration to allow the lint in tests #12725single_match
, single_match_else
: Suggestions are now machine-applicable #12726Released 2024-06-13
View all 102 merged pull requests
legacy_numeric_constants
to style
#12312missing_transmute_annotations
to suspicious
#12239integer_division_remainder_used
to restriction
#12451duplicated_attributes
to suspicious
#12378manual_unwrap_or_default
to suspicious
#12440zero_repeat_side_effects
to suspicious
#12449const_is_empty
to suspicious
#12310box_default
to style
(From perf
) #12601manual_clamp
to complexity
(From nursery
now warn-by-default) #12543readonly_write_lock
to perf
(From nursery
now warn-by-default) #12479module_name_repetitions
: Added the allowed-prefixes
configuration to allow common prefixes. #12573cast_sign_loss
, cast_possible_truncation
, cast_lossless
: Are now allowed in macros #12631manual_clamp
: Now only lints on constant min and max values #12543assigning_clones
: Now considers the msrv
configuration #12511needless_return
, useless_let_if_seq
, mut_mut
, read_zero_byte_vec
, unused_io_amount
, unused_peekable
: Now respects #[allow]
attributes on the affected statement instead #12446cast_lossless
: No longer lints when casting to u128
#12496std_instead_of_core
No longer lints on modules that are only in std
#12447needless_return
: No longer crashes on non-ascii characters #12493Released 2024-05-02
View all 112 merged pull requests
assigning_clones
#12077mixed_attributes_style
#12354empty_docs
#12342unnecessary_get_then_check
#12339multiple_bound_locations
#12259unnecessary_clippy_cfg
#12303deprecated_clippy_cfg_attr
#12292manual_c_str_literals
#11919ref_as_ptr
#12087lint_groups_priority
#11832unnecessary_result_map_or_else
#12169to_string_trait_impl
#12122incompatible_msrv
#12160thread_local_initializer_can_be_made_const
: Now checks the msrv
configuration #12405disallowed_macros
: Code generated by derive macros can no longer allow this lint #12267wildcard_imports
: Add configuration allowed-wildcard-imports
to allow preconfigured wildcards #11979ptr_as_ptr
: No longer ICEs when the cast source is a function call to a local variable #12617cast_sign_loss
: Avoids an infinite loop when casting two chained .unwrap()
calls #12508Released 2024-03-18
View all 93 merged pull requests
suspicious_open_options
#11608option_as_ref_cloned
#12051thread_local_initializer_can_be_made_const
#12026str_split_at_newline
#11987empty_enum_variants_with_brackets
#12047manual_is_variant_and
#11865pub_underscore_fields
#10283eager_transmute
#11981iter_filter_is_some
#12004iter_filter_is_ok
#12004result_filter_map
#11869unconditional_recursion
#11938multiple_crate_versions
: Added the allowed-duplicate-crates
configuration to allow specific crates #12179single_call_fn
: No longer ignores #[allow]
attributes #12183read_zero_byte_vec
: Updated the heuristics used for linting #11766unit_arg
: No longer crashes when checking for const in nested bodies #11977indexing_slicing
: No longer crashes when the array index exceeds usize
#12266clippy.toml
files now include suggestions for existing fields #12180Released 2024-02-08
View all 85 merged pull requests
infinite_loop
#11829ineffective_open_options
#11902uninhabited_references
#11878repeat_vec_with_capacity
#11597test_attr_in_doctest
#11872option_map_or_err_ok
#11864join_absolute_paths
#11453impl_hash_borrow_with_str_and_bytes
#11781iter_over_hash_type
#11791blocks_in_if_conditions
to blocks_in_conditions
#11853implied_bounds_in_impls
to complexity
(Now warn-by-default) #11867if_same_then_else
to style
(Now warn-by-default) #11809missing_safety_doc
, unnecessary_safety_doc
, missing_panics_doc
, missing_errors_doc
: Added the check-private-items
configuration to enable lints on private items #11842impl_trait_in_params
: No longer crashes when a function has generics but no function parameters #11804unused_enumerate_index
: No longer crashes on empty tuples #11756CARGO
environment value #11944Released 2023-12-28
View all 69 merged pull requests
unused_enumerate_index
#10404unnecessary_fallible_conversions
#11669waker_clone_wake
#11698struct_field_names
#11496into_iter_without_iter
#11587iter_without_into_iter
#11527manual_hash_one
#11556read_zero_byte_vec
to nursery
(Now allow-by-default) #11727missing_enforced_import_renames
to style
(Now warn-by-default) #11539needless_raw_string_hashes
to pedantic
(Now allow-by-default) #11415needless_pass_by_ref_mut
to nursery
(Now allow-by-default) #11596declare_interior_mutable_const
and borrow_interior_mutable_const
: Now check the ignore-interior-mutability
config value #11678items_after_test_module
: The suggestion is now machine-applicable #11611redundant_locals
: No longer crashes if variables are rebound above macros #11623implicit_hasher
: No longer lints inside macros, which could cause ICEs #11593cargo clippy --help
now uses colors for readability :tada:Released 2023-11-16
View all 94 merged pull requests
redundant_as_str
#11526needless_borrows_for_generic_args
#11511path_ends_with_ext
#11483unnecessary_map_on_constructor
#11413missing_asserts_for_indexing
#10692iter_out_of_bounds
#11396implied_bounds_in_impls
#11362reserve_after_initialization
#11373should_panic_without_expect
#11204incorrect_clone_impl_on_copy_type
to non_canonical_clone_impl
#11358incorrect_partial_ord_impl_on_ord_type
to non_canonical_partial_ord_impl
#11358non_canonical_clone_impl
to suspicious
(Now warn-by-default) #11358non_canonical_partial_ord_impl
to suspicious
(Now warn-by-default) #11358needless_pass_by_ref_mut
to nursery
(Now allow-by-default) #11596undocumented_unsafe_blocks
: The config values accept-comment-above-statement
and accept-comment-above-attributes
are now true
by default #11170explicit_iter_loop
: Added enforce-iter-loop-reborrow
to disable reborrow linting by default #11418enum_variant_names
: No longer crashes if the threshold is 0 and the enum has no variants #11552cast_possible_truncation
: No longer crashes on values larger than u64::MAX
#11517tuple_array_conversions
: No longer crashes if the array length is not usize #11379useless_conversion
: No longer crashes, when the receiver is a non-fn item #11070Released 2023-10-05
View all 103 merged pull requests
impossible_comparisons
#10843redundant_comparisons
#10843ignored_unit_patterns
#11242readonly_write_lock
#11210filter_map_bool_then
#11115needless_return_with_question_mark
#11031redundant_guards
#10955redundant_locals
#10885absolute_paths
#11003error_impl_error
#11107iter_skip_zero
#11046string_lit_chars_any
#11052four_forward_slashes
#11140format_collect
#11116needless_pass_by_ref_mut
#10900manual_is_infinite
#11049manual_is_finite
#11049incorrect_partial_ord_impl_on_ord_type
#10788read_line_without_trim
#10970type_id_on_box
#10987unwrap_or_else_default
to unwrap_or_default
#10120tuple_array_conversions
to pedantic
(Now allow-by-default) #11146arc_with_non_send_sync
to suspicious
(Now warn-by-default) #11104needless_raw_string_hashes
to pedantic
(Now allow-by-default) #11415unwrap_used
: No longer lints on the never-type or never-like enums #11252expect_used
: No longer lints on the never-type or never-like enums #11252panic_in_result_fn
: No longer triggers on todo!
, unimplemented!
, unreachable!
#11123semicolon_if_nothing_returned
: The suggestion is now machine-applicable with rustfix #11083filter_map_bool_then
: No longer crashes on late-bound regions #11318unwrap_or_default
: No longer crashes on alias types for local items #11258unnecessary_literal_unwrap
: No longer crashes on None.unwrap_or_default()
#11106missing_fields_in_debug
: No longer crashes on non-ADT self types #11069Released 2023-08-24
View all 131 merged pull requests
manual_try_fold
#11012tuple_array_conversions
#11020redundant_at_rest_pattern
#11013needless_pub_self
#10967pub_with_shorthand
#10967pub_without_shorthand
#10967manual_range_patterns
#10968needless_raw_string_hashes
#10884needless_raw_strings
#10884incorrect_clone_impl_on_copy_type
#10925drain_collect
#10835single_range_in_vec_init
#10934unnecessary_literal_unwrap
#10358large_stack_frames
#10827min_ident_chars
#10916needless_if
#10921excessive_nesting
#10672arc_with_non_send_sync
#10898redundant_type_annotations
#10570host_endian_bytes
#10826little_endian_bytes
#10826big_endian_bytes
#10826ptr_cast_constness
#10779needless_else
#10810redundant_clone
to nursery
(Now allow-by-default) #10873undocumented_unsafe_blocks
: Added accept-comment-above-attributes
configuration #10986undocumented_unsafe_blocks
: Added accept-comment-above-statement
configuration. #10886missing_panics_doc
: No longer lints on todo!()
#10976module_inception
: Added allow-private-module-inception
configuration. #10917clippy.toml
now point to the location in the TOML file the error/warning occurred in. #10607excessive_precision
: No longer lints overflowing literals #10952option_map_unwrap_or
: The suggestion now considers the set msrv
config value #11030Released 2023-07-13
Note: Clippy will use a shorter changelog format from now on, if you want a detailed list of all changes, please check out the list of merged pull requests.
View all 78 merged pull requests
non_minimal_cfg
#10763manual_next_back
#10769ref_patterns
#10736default_constructed_unit_structs
#10716manual_while_let_some
#10647needless_bool_assign
#10432items_after_test_module
#10578integer_arithmetic
to arithmetic_side_effects
#10674redundant_clone
to nursery
(Now allow-by-default) #10873invalid_regex
: Now supports the new syntax introduced after regex v1.8.0 #10682semicolon_outside_block
: Added semicolon-outside-block-ignore-multiline
as a new config value. #10656semicolon_inside_block
: Added semicolon-inside-block-ignore-singleline
as a new config value. #10656unnecessary_box_returns
: Added unnecessary-box-size
as a new config value to set the maximum size of T
in Box<T>
to be linted. #10651cargo clippy --explain LINT
now shows possible configuration options for the explained lint #10751Released 2023-06-01
View all 91 merged pull requests
large_futures
#10414missing_assert_message
#10362clear_with_drain
#10528redundant_async_block
#10448collection_is_never_read
#10415let_with_type_underscore
#10467tests_outside_test_module
#10543allow_attributes
#10481suspicious_doc_comments
#10497unnecessary_box_returns
#9102manual_main_separator_str
#10483unnecessary_struct_initialization
#10489manual_slice_size_calculation
#10601lines_filter_map_ok
#10534let_underscore_untyped
to restriction
#10442extra_unused_type_parameters
: No longer lints on public items if avoid-breaking-exported-api
is set #10536len_without_is_empty
: Now also detects async
functions #10359arithmetic_side_effects
: Now correctly handles divisions and modulo expressions if the right-hand-side is unknown #10585nonminimal_bool
: No longer ignores #[allow]
attributes #10588uninit_vec
, uninit_assumed_init
: Now uses a better heuristic #10520ifs_same_cond
: Now also detects immutable method calls. #10350arithmetic_side_effects
: No longer lints on right or left shifts with constant integers, as the compiler warns about them #10309items_after_statements
: #[allow(items_after_statements)]
now works on items #10542significant_drop_tightening
: Was optimized #10533single_component_path_imports
: No longer lints if the import is used relative to self
#10566derivable_impls
: No longer suggests deriving Default
on generics with implicit arguments #10399let_unit_value
: No longer lints if the expression contains an await
#10439double_must_use
: Now ignores async
functions #10589manual_clamp
: No longer lints in constant context #10479almost_swapped
: Now ignores external macros #10502nonminimal_bool
: Now ignores macros #10527needless_return
: No longer lints match statements with incompatible branches #10593use_self
: Do not suggest using Self
in const generic parameters #10375mem_replace_option_with_none
: No longer lints on field expressions #10594items_after_statements
: No longer lints on items from macros #10542print_literal
, write_literal
: No longer lint strings coming from the file!()
macro #10573uninit_vec
, uninit_assumed_init
: Now check the types inside arrays and tuples #10553almost_swapped
: No longer lints if a variable is assigned to itself #10499missing_docs_in_private_items
: No longer lints on public items #10324extra_unused_type_parameters
: The suggestion is now machine applicable #10536match_single_binding
: Now adds a semicolon after the suggestion #10470missing_const_for_fn
: Now includes a note if the change could break compatibility #10618cast_possible_truncation
: Corrected suggestion for float and wildcard casts #10496transmutes_expressible_as_ptr_casts
: The suggestion now includes parentheses when they are required #10454needless_borrow
: No longer panics on ambiguous projections #10403multiple_unsafe_ops_per_block
: Fix ICE when calling a function-like object in an unsafe block #10405clippy-driver
now searches parent directories for clippy.toml
files #10592array-size-threshold
config value #10423Released 2023-04-20
View all 72 merged pull requests
no_mangle_with_rust_abi
#10369significant_drop_tightening
#10163suspicious_command_arg_space
#10317let_underscore_untyped
#10356question_mark_used
#10342extra_unused_type_parameters
#10028impl_trait_in_params
10197transmute_int_to_non_zero
#10360multiple_unsafe_ops_per_block
#10206uninlined_format_args
to pedantic
(Now allow-by-default) #10265unchecked_duration_subtraction
to pedantic
(Now allow-by-default) #10194arithmetic_side_effects
: No longer lints if safe constant values are used. #10310needless_lifetimes
: Now works in local macros #10257unused_io_amount
: Now detects usages of is_ok
and is_err
#10225missing_docs_in_private_items
: Added new configuration missing-docs-in-crate-items
to lint on items visible within the current crate. For example, pub(crate)
items. #10303almost_swapped
: Now detects almost swaps using let
statements #10177wildcard_enum_match_arm
: Now lints missing private variants, for local enums #10250explicit_auto_deref
: Now considers projections when determining if auto deref is applicable #10386manual_let_else
: Now considers side effects of branches before linting #10336uninlined_format_args
: No longer lints for arguments with generic parameters #10343needless_lifetimes
: No longer lints signatures in macros if the lifetime is a metavariable #10380len_without_is_empty
: No longer lints if len
as a non-default signature #10255unusual_byte_groupings
: Relaxed the required restrictions for specific sizes to reduce false positives #10353manual_let_else
: No longer lints if-else
blocks if they can divergent #10332expect_used
, unwrap_used
, dbg_macro
, print_stdout
, print_stderr
: No longer lint in test functions if allow-expect-in-tests
is set #10391unnecessary_safety_comment
: No longer lints code inside macros #10106never_loop
: No longer lints statements following break statements for outer blocks. #10311box_default
: The suggestion now includes the type for trait objects when needed #10382cast_possible_truncation
: Now suggests using try_from
or allowing the lint #10038invalid_regex
: Regex errors for non-literals or regular strings containing escape sequences will now show the complete error #10231transmutes_expressible_as_ptr_casts
: The suggestion now works if the base type is borrowed #10193needless_return
: Now removes all semicolons on the same line #10187suspicious_to_owned
: The suggestion now shows all options clearly #10295bytes_nth
: Now suggests the correct replacement based on the context #10361bool_assert_comparison
: The suggestion is now machine applicable #10218cast_possible_truncation
: Corrected the lint name in the help message #10330needless_return
: The suggestion now works on if sequences #10345needless_lifetimes
: The suggestion is now machine applicable #10222map_entry
: The suggestion no longer expands macros #10346needless_pass_by_value
: Fixed an ICE caused by how late bounds were handled #10328needless_borrow
: No longer panics on ambiguous projections #10403Released 2023-03-09
View all 76 merged pull requests
permissions_set_readonly_false
#10063almost_complete_range
#10043size_of_ref
#10098semicolon_outside_block
#9826semicolon_inside_block
#9826transmute_null_to_fn
#10099fn_null_check
#10099manual_clamp
to nursery
(Now allow-by-default) #10101mutex_atomic
to restriction
#10115derive_hash_xor_eq
to derived_hash_with_manual_eq
#10184collapsible_str_replace
: Now takes MSRV into consideration. The minimal version is 1.58 #10047unused_self
: No longer lints, if the method body contains a todo!()
call #10166derivable_impls
: Now suggests deriving Default
for enums with default unit variants #10161arithmetic_side_effects
: Added two new config values arithmetic-side-effects-allowed-binary
and arithmetic-side-effects-allowed-unary
to allow operation on user types #9840large_const_arrays
, large_stack_arrays
: avoid integer overflow when calculating total array size #10103indexing_slicing
: add new config suppress-restriction-lint-in-const
to enable restriction lints, even if the suggestion might not be applicable #9920needless_borrow
, redundant_clone
: Now track references better and detect more cases #9701derived_hash_with_manual_eq
: Now allows #[derive(PartialEq)]
with custom Hash
implementations #10184manual_is_ascii_check
: Now detects ranges with .contains()
calls #10053transmuting_null
: Now detects const
pointers to all types #10099needless_return
: Now detects more cases for returns of owned values #10110field_reassign_with_default
: No longer lints cases, where values are initializes from closures capturing struct values #10143seek_to_start_instead_of_rewind
: No longer lints, if the return of seek
is used. #10096manual_filter
: Now ignores if expressions where the else branch has side effects or doesn't return None
#10091implicit_clone
: No longer lints if the type doesn't implement clone #10022match_wildcard_for_single_variants
: No longer lints on wildcards with a guard #10056drop_ref
: No longer lints idiomatic expression in match
arms #10142arithmetic_side_effects
: No longer lints on corner cases with negative number literals #9867string_lit_as_bytes
: No longer lints in scrutinies of match
statements #10012manual_assert
: No longer lints in else if
statements #10013needless_return
: don't lint when using do yeet
#10109single_element_loop
: No longer lints, if the loop contains a break
or continue
#10162uninlined_format_args
: No longer suggests inlining arguments in assert!
and debug_assert!
macros before 2021 edition #10055explicit_counter_loop
: No longer ignores counter changes after continue
expressions #10094from_over_into
: No longer lints on opaque types #9982expl_impl_clone_on_copy
: No longer lints on #[repr(packed)]
structs with generic parameters #10189zero_ptr
: Now suggests core::
paths for no_std
crates #10023useless_conversion
: Now suggests removing calls to into_iter()
on an expression implementing Iterator
#10020box_default
: The suggestion now uses short paths #10153default_trait_access
, clone_on_copy
: The suggestion now uses short paths #10160comparison_to_empty
: The suggestion now removes unused deref operations #9962manual_let_else
: Suggestions for or-patterns now include required brackets. #9966match_single_binding
: suggestion no longer introduces unneeded semicolons #10060case_sensitive_file_extension_comparisons
: Now displays a suggestion with Path
#10107empty_structs_with_brackets
: The suggestion is no longer machine applicable, to avoid errors when accessing struct fields #10141identity_op
: Removes borrows in the suggestion when needed #10004suboptimal_flops
: The suggestion now includes parentheses when required #10113iter_kv_map
: Now handles mut
and reference annotations in the suggestion #10159redundant_static_lifetimes
: The suggestion no longer removes mut
from references #10006new_ret_no_self
: Now avoids a stack overflow for impl Trait
types #10086unnecessary_to_owned
: Now handles compiler generated notes better #10027SYSROOT
and --sysroot
can now be set at the same time #10149array-size-threshold
in clippy.toml
#10423Released 2023-01-26
View all 104 merged pull requests
seek_from_current
#9681from_raw_with_void_ptr
#9690misnamed_getters
#9770seek_to_start_instead_of_rewind
#9667suspicious_xor_used_as_pow
#9506unnecessary_safety_doc
#9822unchecked_duration_subtraction
#9570manual_is_ascii_check
#9765unnecessary_safety_comment
#9851let_underscore_future
#9760manual_let_else
#8437needless_collect
to nursery
(Now allow-by-default) #9705or_fun_call
to nursery
(Now allow-by-default) #9829let_underscore_lock
into rustc #9697let_underscore_drop
into rustc #9697bool_to_int_with_if
to pedantic
(Now allow-by-default) #9830index_refutable_slice
to pedantic
(Now warn-by-default) #9975manual_clamp
to nursery
(Now allow-by-default) #10101#![clippy::msrv]
is now tracked correctly #9924#[clippy::msrv]
can now be used as an outer attribute #9860Cargo.toml
or clippy.toml
have changed #9707uninlined_format_args
: Added a new config allow-mixed-uninlined-format-args
to allow the lint, if only some arguments can be inlined #9865needless_lifetimes
: Now provides suggests for individual lifetimes #9743needless_collect
: Now detects needless is_empty
and contains
calls #8744blanket_clippy_restriction_lints
: Now lints, if clippy::restriction
is enabled via the command line arguments #9755mutable_key_type
: Now has the ignore-interior-mutability
configuration, to add types which should be ignored by the lint #9692uninlined_format_args
: Now works for multiline format!
expressions #9945cognitive_complexity
: Now works for async functions #9828 #9836vec_box
: Now avoids an off-by-one error when using the vec-box-size-threshold
configuration #9848never_loop
: Now correctly handles breaks in nested labeled blocks #9858 #9837disallowed_methods
, disallowed_types
, disallowed_macros
: Now correctly resolve paths, if a crate is used multiple times with different versions #9800disallowed_methods
: Can now be used for local methods #9800print_stdout
, print_stderr
: Can now be enabled in test with the allow-print-in-tests
config value #9797from_raw_with_void_ptr
: Now works for Rc
, Arc
, alloc::rc::Weak
and alloc::sync::Weak
types. #9700needless_borrowed_reference
: Now works for struct and tuple patterns with wildcards #9855or_fun_call
: Now supports map_or
methods #9689unwrap_used
, expect_used
: No longer lints in test code #9686fn_params_excessive_bools
: Is now emitted with the lint level at the linted function #9698new_ret_no_self
: No longer lints when impl Trait<Self>
is returned #9733unnecessary_lazy_evaluations
: No longer lints, if the type has a significant drop #9750option_if_let_else
: No longer lints, if any arm has guard #9747explicit_auto_deref
: No longer lints, if the target type is a projection with generic arguments #9813unnecessary_to_owned
: No longer lints, if the suggestion effects types #9796needless_borrow
: No longer lints, if the suggestion is affected by Deref
#9674unused_unit
: No longer lints, if lifetimes are bound to the return type #9849mut_mut
: No longer lints cases with unsized mutable references #9835bool_to_int_with_if
: No longer lints in const context #9738use_self
: No longer lints in macros #9704unnecessary_operation
: No longer lints, if multiple macros are involved #9981allow_attributes_without_reason
: No longer lints inside external macros #9630question_mark
: No longer lints for if let Err()
with an else
branch #9722unnecessary_cast
: No longer lints if the identifier and cast originate from different macros #9980arithmetic_side_effects
: Now detects operations with associated constants #9592explicit_auto_deref
: No longer lints, if the initial value is not a reference or reference receiver #9997module_name_repetitions
, single_component_path_imports
: Now handle #[allow]
attributes correctly #9879bool_to_int_with_if
: No longer lints if let
statements #9714needless_borrow
: No longer lints, if
-else
-statements that require the borrow #9791needless_borrow
: No longer lints borrows, if moves were illegal #9711manual_swap
: No longer lints in const context #9871missing_safety_doc
, missing_errors_doc
, missing_panics_doc
: No longer show the entire item in the lint emission. #9772needless_lifetimes
: Only suggests '_
when it's applicable #9743use_self
: Now suggests full paths correctly #9726redundant_closure_call
: Now correctly deals with macros during suggestion creation #9987unnecessary_cast
: Suggestions now correctly deal with references #9996unnecessary_join
: Suggestions now correctly use turbofish operators #9779equatable_if_let
: Can now suggest matches!
replacements #9368string_extend_chars
: Suggestions now correctly work for str
slices #9741redundant_closure_for_method_calls
: Suggestions now include angle brackets and generic arguments if needed #9745manual_let_else
: Suggestions no longer expand macro calls #9943infallible_destructuring_match
: Suggestions now preserve references #9850result_large_err
: The error now shows the largest enum variant #9662needless_return
: Suggestions are now formatted better #9967unused_rounding
: The suggestion now preserves the original float literal notation #9870result_large_err
: Fixed ICE for empty enums #10007redundant_allocation
: Fixed ICE for types with bounded variables #9773unused_rounding
: Fixed ICE, if _
was used as a separator #10001Released 2022-12-15
View all 116 merged pull requests
manual_clamp
#9484missing_trait_methods
#9670unused_format_specs
#9637iter_kv_map
#9409manual_filter
#9451box_default
#9511implicit_saturating_add
#9549as_ptr_cast_mut
#9572disallowed_macros
#9495partial_pub_fields
#9658uninlined_format_args
#9233cast_nan_to_int
#9617positional_named_format_parameters
was uplifted to rustc under the new name named_arguments_used_positionally
#8518implicit_saturating_sub
to style
(Now warn-by-default) #9584derive_partial_eq_without_eq
to nursery
(now allow-by-default) #9536nonstandard_macro_braces
: Now includes matches!()
in the default lint config #9471suboptimal_flops
: Now supports multiplication and subtraction operations #9581arithmetic_side_effects
: Now detects cases with literals behind references #9587upper_case_acronyms
: Now also checks enum names #9580needless_borrowed_reference
: Now lints nested patterns #9573unnecessary_cast
: Now works for non-trivial non-literal expressions #9576arithmetic_side_effects
: Now detects operations with custom types #9559disallowed_methods
, disallowed_types
: Not correctly lints types, functions and macros with the same path #9495self_named_module_files
, mod_module_files
: Now take remapped path prefixes into account #9475bool_to_int_with_if
: Now detects the inverse if case #9476arithmetic_side_effects
: Now allows operations that can't overflow #9474unnecessary_lazy_evaluations
: No longer lints in external macros #9486needless_borrow
, explicit_auto_deref
: No longer lint on unions that require the reference #9490almost_complete_letter_range
: No longer lints in external macros #9467drop_copy
: No longer lints on idiomatic cases in match arms #9491question_mark
: No longer lints in const context #9487collapsible_if
: Suggestion now work in macros #9410std_instead_of_core
: No longer triggers on unstable modules #9545unused_peekable
: No longer lints, if the peak is done in a closure or function #9465useless_attribute
: No longer lints on #[allow]
attributes for unsafe_removed_from_name
#9593unnecessary_lazy_evaluations
: No longer suggest switching to early evaluation when type has custom Drop
implementation #9551unnecessary_cast
: No longer lints on negative hexadecimal literals when cast as floats #9609use_self
: No longer lints in proc macros #9454never_loop
: Now takes let ... else
statements into consideration. #9496default_numeric_fallback
: Now ignores constants #9636uninit_vec
: No longer lints Vec::set_len(0)
#9519arithmetic_side_effects
: Now ignores references to integer types #9507large_stack_arrays
: No longer lints inside static items #9466ref_option_ref
: No longer lints if the inner reference is mutable #9684ptr_arg
: No longer lints if the argument is used as an incomplete trait object #9645should_implement_trait
: Now also works for default
methods #9546derivable_impls
: The suggestion is now machine applicable #9429match_single_binding
: The suggestion now handles scrutinies with side effects better #9601zero_prefixed_literal
: Only suggests using octal numbers, if this is possible #9652rc_buffer
: The suggestion is no longer machine applicable to avoid semantic changes #9633print_literal
, write_literal
, uninlined_format_args
: The suggestion now ignores comments after the macro call. #9586expect_fun_call
:Improved the suggestion for format!
calls with captured variables #9586nonstandard_macro_braces
: The suggestion is now machine applicable and will no longer replace brackets inside the macro argument. #9499from_over_into
: The suggestion is now a machine applicable and contains explanations #9649needless_return
: The automatic suggestion now removes all required semicolons #9497to_string_in_format_args
: The suggestion now keeps parenthesis around values #9590manual_assert
: The suggestion now preserves comments #9479redundant_allocation
: The suggestion applicability is now marked MaybeIncorrect
to avoid semantic changes #9634assertions_on_result_states
: The suggestion has been corrected, for cases where the assert!
is not in a statement. #9453nonminimal_bool
: The suggestion no longer expands macros #9457collapsible_match
: Now specifies field names, when a struct is destructed #9685unnecessary_cast
: The suggestion now adds parenthesis for negative numbers #9577redundant_closure
: The suggestion now works for impl FnMut
arguments #9556unnecessary_to_owned
: Avoid ICEs in favor of false negatives if information is missing #9505 #10027manual_range_contains
: No longer ICEs on values behind references #9627needless_pass_by_value
: No longer ICEs on unsized dyn Fn
arguments #9531*_interior_mutable_const
lints: no longer ICE on const unions containing !Freeze
types #9539rustc_tools_util
for version information on Crates.io
. (Further adjustments will not be published as part of this changelog)Released 2022-11-03
View all 86 merged pull requests
--explain <LINT>
command to show the lint description in the console #8952unused_peekable
#9258collapsible_str_replace
#9269manual_string_new
#9295iter_on_empty_collections
#9187iter_on_single_items
#9187bool_to_int_with_if
#9412multi_assignments
#9379result_large_err
#9373partialeq_to_none
#9288suspicious_to_owned
#8984cast_slice_from_raw_parts
#9247manual_instant_elapsed
#9264significant_drop_in_scrutinee
to nursery
(now allow-by-default) #9302logic_bug
to overly_complex_bool_expr
#9306arithmetic
to arithmetic_side_effects
#9443only_used_in_recursion
to complexity (now warn-by-default) #8804assertions_on_result_states
to restriction (now allow-by-default) #9273blacklisted_name
to disallowed_names
#8974option_if_let_else
: Now also checks for match expressions #8696explicit_auto_deref
: Now lints on implicit returns in closures #9126needless_borrow
: Now considers trait implementations #9136suboptimal_flops
, imprecise_flops
: Now lint on constant expressions #9404if_let_mutex
: Now detects mutex behind references and warns about deadlocks #9318unit_arg
default_trait_access
missing_docs_in_private_items
: No longer trigger in code generated from proc-macros #8694unwrap_used
: Now lints uses of unwrap_err
#9338expect_used
: Now lints uses of expect_err
#9338transmute_undefined_repr
: Now longer lints if the first field is compatible with the other type #9287unnecessary_to_owned
: No longer lints, if type change cased errors in the caller function #9424match_like_matches_macro
: No longer lints, if there are comments inside the match expression #9276partialeq_to_none
: No longer trigger in code generated from macros #9389arithmetic_side_effects
: No longer lints expressions that only use literals #9365explicit_auto_deref
: Now ignores references on block expressions when the type is Sized
, on dyn Trait
returns and when the suggestion is non-trivial #9126trait_duplication_in_bounds
: Now better tracks bounds to avoid false positives #9167format_in_format_args
: Now suggests cases where the result is formatted again #9349only_used_in_recursion
: No longer lints on function without recursions and takes external functions into account #8804missing_const_for_fn
: No longer lints in proc-macros #9308non_ascii_literal
: Allow non-ascii comments in tests and make sure #[allow]
attributes work in tests #9327question_mark
: No longer lint if let
s with subpatterns #9348needless_collect
: No longer lints in loops #8992mut_mutex_lock
: No longer lints if the mutex is behind an immutable reference #9418needless_return
: Now ignores returns with arguments #9381range_plus_one
, range_minus_one
: Now ignores code with macros #9446assertions_on_result_states
: No longer lints on the unit type #9273unwrap_or_else_default
: Now suggests unwrap_or_default()
for empty strings #9421if_then_some_else_none
: Now also suggests bool::then_some
#9289redundant_closure_call
: The suggestion now works for async closures #9053suboptimal_flops
: Now suggests parenthesis when they are required #9394case_sensitive_file_extension_comparisons
: Now suggests map_or(..)
instead of map(..).unwrap_or
#9341or_fun_call
: Now suggest Entry::or_default
for Entry::or_insert(Default::default())
#9342unwrap_used
: Only suggests expect
if expect_used
is allowed #9223useless_format
for literals #9406vec_init_then_push
#9441Released 2022-09-22
View all 110 merged pull requests
arithmetic_side_effects
#9130invalid_utf8_in_unchecked
#9105assertions_on_result_states
#9225manual_find
#8649manual_retain
#8972default_instead_of_iter_empty
#8989manual_rem_euclid
#9031obfuscated_if_else
#9148std_instead_of_core
#9103std_instead_of_alloc
#9103alloc_instead_of_core
#9103explicit_auto_deref
#8355format_push_string
to restriction
(now allow-by-default) #9161significant_drop_in_scrutinee
: Now gives more context in the lint message #8981single_match
, single_match_else
: Now catches more Option
cases #8985unused_async
: Now works for async methods #9025manual_filter_map
, manual_find_map
: Now lint more expressions #8958question_mark
: Now works for simple if let
expressions #8356undocumented_unsafe_blocks
: Now finds comments before the start of closures #9117trait_duplication_in_bounds
: Now catches duplicate bounds in where clauses #8703shadow_reuse
, shadow_same
, shadow_unrelated
: Now lint in const blocks #9124slow_vector_initialization
: Now detects cases with vec.capacity()
#8953unused_self
: Now respects the avoid-breaking-exported-api
config option #9199box_collection
: Now supports all std collections #9170significant_drop_in_scrutinee
: Now ignores calls to IntoIterator::into_iter
#9140while_let_loop
: Now ignores cases when the significant drop order would change #8981branches_sharing_code
: Now ignores cases where moved variables have a significant drop or variable modifications can affect the conditions #9138let_underscore_lock
: Now ignores bindings that aren't locked #8990trivially_copy_pass_by_ref
: Now tracks lifetimes and ignores cases where unsafe pointers are used #8639let_unit_value
: No longer ignores #[allow]
attributes on the value #9082declare_interior_mutable_const
: Now ignores the thread_local!
macro #9015if_same_then_else
: Now ignores branches with todo!
and unimplemented!
#9006enum_variant_names
: Now ignores names with _
prefixes #9032let_unit_value
: Now ignores cases, where the unit type is manually specified #9056match_same_arms
: Now ignores branches with todo!
#9207assign_op_pattern
: Ignores cases that break borrowing rules #9214extra_unused_lifetimes
: No longer triggers in derive macros #9037mismatching_type_param_order
: Now ignores complicated generic parameters #9146equatable_if_let
: No longer lints in macros #9074new_without_default
: Now ignores generics and lifetime parameters on fn new
#9115needless_borrow
: Now ignores cases that result in the execution of different traits #9096declare_interior_mutable_const
: No longer triggers in thread-local initializers #9246type_repetition_in_bounds
: The suggestion now works with maybe bounds #9132transmute_ptr_to_ref
: Now suggests pointer::cast
when possible #8939useless_format
: Now suggests the correct variable name #9237or_fun_call
: The lint emission will now only span over the unwrap_or
call #9144neg_multiply
: Now suggests adding parentheses around suggestion if needed #9026unnecessary_lazy_evaluations
: Now suggest for bool::then_some
for lazy evaluation #9099manual_flatten
: Improved message for long code snippets #9156explicit_counter_loop
: The suggestion is now machine applicable #9149needless_borrow
: Now keeps parentheses around fields, when needed #9210while_let_on_iterator
: The suggestion now works in FnOnce
closures #9134#![feature(generic_const_exprs)]
usage #9241question_mark
: Fix ICE on zero field tuple structs #9244needless_option_take
: Now includes a “What it does” and “Why is this bad?” section. #9022--cap-lints=allow
and only --force-warn
ing some will now work with Clippy's driver #9036rust-version
from Cargo.toml
to identify the minimum supported rust version #8774Released 2022-08-11
View all 91 merged pull requests
borrow_deref_ref
#7930doc_link_with_quotes
#8385no_effect_replace
#8754rc_clone_in_vec_init
#8769derive_partial_eq_without_eq
#8796mismatching_type_param_order
#8831duplicate_mod
#8832unused_rounding
#8866get_first
#8882swap_ptr_to_ref
#8916almost_complete_letter_range
#8918needless_parens_on_range_literals
#8933as_underscore
#8934eval_order_dependence
to mixed_read_write_in_expression
, move to nursery
#8621undocumented_unsafe_blocks
: Now also lints on unsafe trait implementations #8761empty_line_after_outer_attr
: Now also lints on argumentless macros #8790expect_used
: Now can be disabled in tests with the allow-expect-in-tests
option #8802unwrap_used
: Now can be disabled in tests with the allow-unwrap-in-tests
option #8802disallowed_methods
: Now also lints indirect usages #8852get_last_with_len
: Now also lints VecDeque
and any deref to slice #8862manual_range_contains
: Now also lints on chains of &&
and ||
#8884rc_clone_in_vec_init
: Now also lints on Weak
#8885dbg_macro
: Introduce allow-dbg-in-tests
config option #8897use_self
: Now also lints on TupleStruct
and Struct
patterns #8899manual_find_map
and manual_filter_map
: Now also lints on more complex method chains inside map
#8930needless_return
: Now also lints on macro expressions in return statements #8932doc_markdown
: Users can now indicate, that the doc-valid-idents
config should extend the default and not replace it #8944disallowed_names
: Users can now indicate, that the disallowed-names
config should extend the default and not replace it #8944never_loop
: Now checks for continue
in struct expression #9002useless_transmute
: No longer lints on types with erased regions #8564vec_init_then_push
: No longer lints when further extended #8699cmp_owned
: No longer lints on From::from
for Copy
types #8807redundant_allocation
: No longer lints on fat pointers that would become thin pointers #8813derive_partial_eq_without_eq
:empty_line_after_outer_attr
: No longer lints empty lines in inner string values #8892branches_sharing_code
: No longer lints when using different binding names #8901significant_drop_in_scrutinee
: No longer lints on Try ?
and await
desugared expressions #8902checked_conversions
: No longer lints in const
contexts #8907iter_overeager_cloned
: No longer lints on .cloned().flatten()
when T::Item
doesn't implement IntoIterator
#8960vec_init_then_push
: Suggest to remove mut
binding when possible #8699manual_range_contains
: Fix suggestion for integers with different signs #8763identity_op
: Add parenthesis to suggestions where required #8786cast_lossless
: No longer gives wrong suggestion on usize
/isize
->f64
#8778rc_clone_in_vec_init
: Add suggestion #8814cast_abs_to_unsigned
: Do not remove cast if it's required #8876significant_drop_in_scrutinee
: Improve lint message for types that are not references and not trivially clone-able #8902for_loops_over_fallibles
: Now suggests the correct variant of iter()
, iter_mut()
or into_iter()
#8941let_unit_value
when calling a static
/const
callable type #8835static
/const
s #8896needless_late_init
#8912Released 2022-06-30
View all 90 merged pull requests
large_include_file
#8727cast_abs_to_unsigned
#8635err_expect
#8606unnecessary_owned_empty_strings
#8660empty_structs_with_brackets
#8594crate_in_macro_def
#8576needless_option_take
#8665bytes_count_to_len
#8711is_digit_ascii_radix
#8624await_holding_invalid_type
#8707trim_split_whitespace
#8575pub_use
#8670format_push_string
#8626empty_drop
#8571drop_non_drop
#8630forget_non_drop
#8630only_used_in_recursion
to nursery
(now allow-by-default) #8783stable_sort_primitive
to pedantic
(now allow-by-default) #8716manual_split_once
and needless_splitn
#8631map_identity
: Now checks for needless map_err
#8487extra_unused_lifetimes
: Now checks for impl lifetimes #8737cast_possible_truncation
: Now catches more cases with larger shift or divide operations #8687identity_op
: Now checks for modulo expressions #8519panic
: No longer lint in constant context #8592manual_split_once
: Now lints manual iteration of splitn
#8717self_named_module_files
, mod_module_files
: Now handle relative module paths #8611unsound_collection_transmute
: Now has better size and alignment checks #8648unnested_or_patterns
: Ignore cases, where the suggestion would be longer #8619rest_pat_in_fully_bound_structs
: Now ignores structs marked with #[non_exhaustive]
#8690needless_late_init
: No longer lints if let
statements, let mut
bindings or instances that changes the drop order significantly #8617unnecessary_cast
: No longer lints to casts to aliased or non-primitive types #8596init_numbered_fields
: No longer lints type aliases #8780needless_option_as_deref
: No longer lints for as_deref_mut
on Option
values that can't be moved #8646mistyped_literal_suffixes
: Now ignores float literals without an exponent #8742undocumented_unsafe_blocks
: Now ignores unsafe blocks from proc-macros and works better for sub-expressions #8450same_functions_in_if_condition
: Now allows different constants, even if they have the same value #8673needless_match
: Now checks for more complex types and ignores type coercion #8549assertions_on_constants
: Now ignores constants from cfg!
macros #8614indexing_slicing
: Fix false positives with constant indices in #8588iter_with_drain
: Now ignores iterator references #8668useless_attribute
: Now allows redundant_pub_crate
on use
items #8743cast_ptr_alignment
: Now ignores expressions, when used for unaligned reads and writes #8632wrong_self_convention
: Now allows &mut self
and no self as arguments for is_*
methods #8738mut_from_ref
: Only lint in unsafe code #8647redundant_pub_crate
: Now allows macro exports #8736needless_match
: Ignores cases where the else block expression is different #8700transmute_int_to_char
: Now allows transmutations in const
code #8610manual_non_exhaustive
: Ignores cases, where the enum value is used #8645redundant_closure
: Now ignores coerced closure #8431identity_op
: Is now ignored in cases where extra brackets would be needed #8730let_unit_value
: Now ignores cases which are used for type inference #8563manual_split_once
: Fixed incorrect suggestions for single result accesses #8631bytes_nth
: Fix typos in the diagnostic message #8403mistyped_literal_suffixes
: Now suggests the correct integer types #8742unnecessary_to_owned
: Fixed suggestion based on the configured msrv #8692single_element_loop
: Improve lint for Edition 2021 arrays #8616manual_bits
: Now includes a cast for proper type conversion, when needed #8677option_map_unit_fn
, result_map_unit_fn
: Fix some incorrect suggestions #8584collapsible_else_if
: Add whitespace in suggestion #8729transmute_bytes_to_str
: Now suggest from_utf8_unchecked
in const
context #8612map_clone
: Improve message and suggestion based on the msrv #8688needless_late_init
: Now shows the let
statement where it was first initialized #8779only_used_in_recursion
#8691cast_slice_different_sizes
#8720iter_overeager_cloned
#8602undocumented_unsafe_blocks
#8686Released 2022-05-19
View all 60 merged pull requests
only_used_in_recursion
#8422cast_enum_truncation
#8381missing_spin_loop
#8174deref_by_slicing
#8218needless_match
#8471allow_attributes_without_reason
#8504print_in_format_impl
#8253unnecessary_find_map
#8489or_then_unwrap
#8561unnecessary_join
#8579iter_with_drain
#8483cast_enum_constructor
#8562cast_slice_different_sizes
#8445transmute_undefined_repr
to nursery
(now allow-by-default) #8432try_err
to restriction
#8544iter_with_drain
to nursery
#8541to_string_in_display
to recursive_format_impl
#8188dbg_macro
: The lint level can now be set with crate attributes and works inside macros #8411ptr_as_ptr
: Now works inside macros #8442use_self
: Now works for variants in match expressions #8456await_holding_lock
: Now lints for parking_lot::{Mutex, RwLock}
#8419recursive_format_impl
: Now checks for format calls on self
#8188new_without_default
: No longer lints for new()
methods with #[doc(hidden)]
#8472transmute_undefined_repr
: No longer lints for single field structs with #[repr(C)]
, generic parameters, wide pointers, unions, tuples and allow several forms of type erasure #8425 #8553 #8440 #8547match_single_binding
, match_same_arms
, match_as_ref
, match_bool
: No longer lint match
expressions with cfg
ed arms #8443single_component_path_imports
: No longer lint on macros #8537ptr_arg
: Allow &mut
arguments for Cow<_>
#8552needless_borrow
: No longer lints for method calls #8441match_same_arms
: Now ensures that interposing arm patterns don't overlap #8232default_trait_access
: Now allows Default::default
in update expressions #8433redundant_slicing
: Fixed suggestion for a method calls #8218map_flatten
: Long suggestions will now be split up into two help messages #8520unnecessary_lazy_evaluations
: Now shows suggestions for longer code snippets #8543unnecessary_sort_by
: Now suggests Reverse
including the path #8462search_is_some
: More suggestions are now MachineApplicable
#8536new_without_default
: Document pub
requirement for the struct and fields #8429Released 2022-04-07
View all 73 merged pull requests
single_char_lifetime_names
#8236iter_overeager_cloned
#8203transmute_undefined_repr
#8398default_union_representation
#8289manual_bits
#8213borrow_as_ptr
#8210disallowed_methods
and disallowed_types
to style
(now warn-by-default) #8261ref_in_deref
to needless_borrow
#8217mutex_atomic
to nursery
(now allow-by-default) #8260ptr_arg
: Now takes the argument usage into account and lints for mutable references #8271unused_io_amount
: Now supports async read and write traits #8179while_let_on_iterator
: Improved detection to catch more cases #8221trait_duplication_in_bounds
: Now covers trait functions with Self
bounds #8252unwrap_used
: Now works for .get(i).unwrap()
and .get_mut(i).unwrap()
#8372map_clone
: The suggestion takes msrv
into account #8280manual_bits
and borrow_as_ptr
: Now track the clippy::msrv
attribute #8280disallowed_methods
: Now works for methods on primitive types #8112not_unsafe_ptr_arg_deref
: Now works for type aliases #8273needless_question_mark
: Now works for async functions #8311iter_not_returning_iterator
: Now handles type projections #8228wrong_self_convention
: Now detects wrong self
references in more cases #8208single_match
: Now works for match
statements with tuples #8322erasing_op
: No longer triggers if the output type changes #8204if_same_then_else
: No longer triggers for if let
statements #8297manual_memcpy
: No longer lints on VecDeque
#8226trait_duplication_in_bounds
: Now takes path segments into account #8315deref_addrof
: No longer lints when the dereference or borrow occurs in different a context #8268type_repetition_in_bounds
: Now checks for full equality to prevent false positives #8224ptr_arg
: No longer lint for mutable references in traits #8369implicit_clone
: No longer lints for double references #8231needless_lifetimes
: No longer lints lifetimes for explicit self
types #8278op_ref
: No longer lints in BinOp
impl if that can cause recursion #8298enum_variant_names
: No longer triggers for empty variant names #8329redundant_closure
: No longer lints for Arc<T>
or Rc<T>
#8193iter_not_returning_iterator
: No longer lints on trait implementations but therefore on trait definitions #8228single_match
: No longer lints on exhaustive enum patterns without a wildcard #8322manual_swap
: No longer lints on cases that involve automatic dereferences #8220useless_format
: Now works for implicit named arguments #8295needless_borrow
: Prevent mutable borrows being moved and suggest removing the borrow on method calls #8217chars_next_cmp
: Correctly escapes the suggestion #8376explicit_write
: Add suggestions for write!
s with format arguments #8365manual_memcpy
: Suggests copy_from_slice
when applicable #8226or_fun_call
: Improved suggestion display for long arguments #8292unnecessary_cast
: Now correctly includes the sign #8350cmp_owned
: No longer flips the comparison order #8299explicit_counter_loop
: Now correctly suggests iter()
on references #8382map_flatten
: Add documentation for the Option
type #8354Released 2022-02-24
View all 94 merged pull requests
index_refutable_slice
#7643needless_splitn
#7896unnecessary_to_owned
#7978needless_late_init
#7995octal_escapes
#8007return_self_not_must_use
#8071init_numbered_fields
#8170if_then_panic
to pedantic
and rename to manual_assert
(now allow-by-default) #7810disallow_type
to disallowed_types
and disallowed_method
to disallowed_methods
#7984map_flatten
to complexity
(now warn-by-default) #8054match_overlapping_arm
: Fix false negative where after included ranges, overlapping ranges weren't linted anymore #7909deprecated_cfg_attr
: Now takes the specified MSRV into account #7944cast_lossless
: Now also lints for bool
to integer casts #7948let_underscore_lock
: Also emit lints for the parking_lot
crate #7957needless_borrow
#7977strlen_on_c_strings
8001non_ascii_literal
: Now also lints on char
s, not just string
s #8034single_char_pattern
: Now also lints on split_inclusive
, split_once
, rsplit_once
, replace
, and replacen
#8077unwrap_or_else_default
: Now also lints on std
constructors like Vec::new
, HashSet::new
, and HashMap::new
#8163shadow_reuse
: Now also lints on shadowed if let
bindings, instead of shadow_unrelated
#8165or_fun_call
, unnecessary_lazy_evaluations
: Improve heuristics, so that cheap functions (e.g. calling .len()
on a Vec
) won't get linted anymore #7639manual_split_once
: No longer suggests code changing the original behavior #7896no_effect
or unnecessary_operation
warning for unit struct implementing FnOnce
#7898semicolon_if_nothing_returned
: Fixed a bug, where the lint wrongly triggered on let-else
statements #7955if_then_some_else_none
: No longer lints if there is an early return #7980needless_collect
: No longer suggests removal of collect
when removal would create code requiring mutably borrowing a value multiple times #7982shadow_same
: Fix false positive for async
function's params #7997suboptimal_flops
: No longer triggers in constant functions #8009type_complexity
: No longer lints on associated types in traits #8030question_mark
: No longer lints if returned object is not local #8080option_if_let_else
: No longer lint on complex sub-patterns #8086blocks_in_if_conditions
: No longer lints on empty closures #8100enum_variant_names
: No longer lint when first prefix is only a substring of a camel-case word #8127identity_op
: Only lint on integral operands #8183search_is_some
: Fix suggestion for any()
not taking item by reference #7463almost_swapped
: Now detects if there is a no_std
or no_core
attribute and adapts the suggestion accordingly #7877redundant_pattern_matching
: Fix suggestion for deref expressions #7949explicit_counter_loop
: Now also produces a suggestion for non-usize
types #7950manual_map
: Fix suggestion when used with unsafe functions and blocks #7968option_map_or_none
: Suggest map
over and_then
when possible #7971option_if_let_else
: No longer expands macros in the suggestion #7974iter_cloned_collect
: Suggest copied
over cloned
when possible #8006doc_markdown
: No longer uses inline hints to improve readability of suggestion #8011needless_question_mark
: Now better explains the suggestion #8028single_char_pattern
: Escape backslash \
in suggestion #8067needless_bool
: Suggest a != b
over !(a == b)
#8117iter_skip_next
: Suggest to add a mut
if it is necessary in order to apply this lints suggestion #8133neg_multiply
: Now produces a suggestion #8144needless_return
: Now suggests the unit type ()
over an empty block {}
in match arms #8185suboptimal_flops
: Now gives a syntactically correct suggestion for to_radians
and to_degrees
#8187print_stdout
, print_stderr
, dbg_macro
: Document how the lint level can be changed crate-wide #8040README
that config changes don't apply to already compiled code #8175cargo dev lint
command, to run your modified Clippy version on a file #7917Released 2022-01-13
View all 68 merged pull requests
non_send_fields_in_send_ty
to nursery
(now allow-by-default) #8075useless_format
: Handle implicit named arguments #8295transmute_num_to_bytes
#7805match_str_case_mismatch
#7806format_in_format_args
, to_string_in_format_args
#7743uninit_vec
#7682fn_to_numeric_cast_any
#7705undocumented_unsafe_blocks
#7748trailing_empty_array
#7838string_slice
#7878non_send_fields_in_send_ty
to suspicious
#7874non_ascii_literal
to restriction
#7907question_mark
now covers Result
#7840useless_format
recognize bare format!("")
#7801no_effect
#7775match_ref_pats
to check for multiple reference patterns #7800implicit_saturating_sub
with else
clause #7832question_mark
when there is call in conditional predicate #7860mut_mut
no longer lints when type is defined in external macros #7795eq_op
in test functions #7811cast_possible_truncation
no longer lints when cast is coming from signum
method call #7850match_str_case_mismatch
no longer lints on uncased characters #7865ptr_arg
no longer lints references to type aliases #7890missing_safety_doc
now also accepts “implementation safety” headers #7856missing_safety_doc
no longer lints if any parent has #[doc(hidden)]
attribute #7849if_not_else
now ignores else-if statements #7895cast_possible_truncation
on bit-reducing operations #7819field_reassign_with_default
when Drop
and Copy
are involved #7794unnecessary_sort_by
now checks if argument implements Ord
trait #7824match_overlapping_arm
#7847needless_lifetimes
false positive in async
function definition #7901::
when doc_markdown
suggests to use ticks #7916doc_markdown
missing backticks lint #7904equatable_if_let
no longer expands macros in the suggestion #7788shadow_reuse
suggestion less verbose #7782enum_variant_names
#7873undocumented_unsafe_blocks
#7891#[must_use]
lints (must_use_unit
, double_must_use
, must_use_candidate
, let_underscore_must_use
) #7827match_result_ok
#7815disallowed_types
#7791manual_assert
and match_wild_err_arm
for #![no_std]
and Rust 2021. #7851semicolon_if_nothing_returned
on macros containing while loops #7789literal-suffix-style
to enforce a certain style writing unseparated_literal_suffix
#7726Released 2021-12-02
View all 148 merged pull requests
negative_feature_names
#7539redundant_feature_names
#7539mod_module_files
#7543self_named_module_files
#7543manual_split_once
#7565derivable_impls
#7570needless_option_as_deref
#7596iter_not_returning_iterator
#7610same_name_method
#7653manual_assert
#7669non_send_fields_in_send_ty
#7709equatable_if_let
#7762shadow_unrelated
to restriction
#7338option_if_let_else
to nursery
#7568branches_sharing_code
to nursery
#7595if_let_some_result
to match_result_ok
which now also handles while let
cases #7608many_single_char_names
to pedantic
#7671float_cmp
to pedantic
#7692box_vec
to box_collection
and lint on more general cases #7693invalid_atomic_ordering
to rustc rust-lang/rust#84039shadow*
lints, so that they find a lot more shadows and are not limited to certain patterns #7338avoid-breaking-exported-api
configuration now also works for box_collection
, redundant_allocation
, rc_buffer
, vec_box
, option_option
, linkedlist
, rc_mutex
#7560unnecessary_unwrap
: Now also checks for expect
s #7584disallowed_methods
: Allow adding a reason that will be displayed with the lint message #7621approx_constant
: Now checks the MSRV for LOG10_2
and LOG2_10
#7629approx_constant
: Add TAU
#7642needless_borrow
: Now also lints on needless mutable borrows #7657missing_safety_doc
: Now also lints on unsafe traits #7734manual_map
: No longer lints when the option is borrowed in the match and also consumed in the arm #7531filter_next
: No longer lints if filter
method is not the Iterator::filter
method #7562manual_flatten
: No longer lints if expression is used after if let
#7566option_if_let_else
: Multiple fixes #7573break
and continue
statements local to the would-be closure are allowedredundant_allocation
: No longer lints on Box<Box<dyn T>>
which replaces wide pointers with thin pointers #7592bool_assert_comparison
: No longer lints on types that do not implement the Not
trait with Output = bool
#7605mut_range_bound
: No longer lints on range bound mutations, that are immediately followed by a break;
#7607mutable_key_type
: Improve accuracy and document remaining false positives and false negatives #7640redundant_closure
: Rewrite the lint to fix various false positives and false negatives #7661large_enum_variant
: No longer wrongly identifies the second largest variant #7677needless_return
: No longer lints on let-else expressions #7685suspicious_else_formatting
: No longer lints in proc-macros #7707excessive_precision
: No longer lints when in some cases the float was already written in the shortest form #7722doc_markdown
: No longer lints on intra-doc links #7772unnecessary_operation
: Recommend using an assert!
instead of using a function call in an indexing operation #7453manual_split_once
: Produce semantically equivalent suggestion when rsplitn
is used #7663while_let_on_iterator
: Produce correct suggestion when using &mut
#7690manual_assert
: No better handles complex conditions #7741suspicious_map
: Now also suggests to use inspect
as an alternative #7770Released 2021-10-21
View all 38 merged pull requests
needless_continue
: Now also lints in loop { continue; }
case #7477disallowed_types
: Now also primitive types can be disallowed #7488manual_swap
: Now also lints on xor swaps #7506map_flatten
: Now also lints on the Result
type #7522no_effect
: Now also lints on inclusive ranges #7556nonstandard_macro_braces
: No longer lints on similar named nested macros #7478too_many_lines
: No longer lints in closures to avoid duplicated diagnostics #7534similar_names
: No longer complains about iter
and item
being too similar #7546similar_names
: No longer suggests to insert or add an underscore as a fix #7221new_without_default
: No longer shows the full qualified type path when suggesting adding a Default
implementation #7493while_let_on_iterator
: Now suggests re-borrowing mutable references #7520extend_with_drain
: Improve code suggestion for mutable and immutable references #7533trivially_copy_pass_by_ref
: Now properly handles Self
type #7535never_loop
: Now suggests using if let
instead of a for
loop when applicable #7541cargo clippy --help
now also explains the --fix
and --no-deps
flag #7492unnested_or_patterns
: Removed or_patterns
feature gate in the code example #7507Released 2021-09-09
View all 83 merged pull requests
cargo clippy --fix
:tada: #7405rc_mutex
#7316nonstandard_macro_braces
#7299strlen_on_c_strings
#7243self_named_constructors
#7403disallowed_script_idents
#7400disallowed_types
#7315missing_enforced_import_renames
#7300extend_with_drain
#7270from_iter_instead_of_collect
to pedantic
#7375suspicious
as a new lint group for code that is most likely wrong or useless #7350blanket_clippy_restriction_lints
to suspicious
empty_loop
to suspicious
eval_order_dependence
to suspicious
float_equality_without_abs
to suspicious
for_loops_over_fallibles
to suspicious
misrefactored_assign_op
to suspicious
mut_range_bound
to suspicious
mutable_key_type
to suspicious
suspicious_arithmetic_impl
to suspicious
suspicious_assignment_formatting
to suspicious
suspicious_else_formatting
to suspicious
suspicious_map
to suspicious
suspicious_op_assign_impl
to suspicious
suspicious_unary_op_formatting
to suspicious
while_let_on_iterator
: Now suggests &mut iter
inside closures #7262doc_markdown
:wildcard_enum_match_arm
, match_wildcard_for_single_variants
: Now allows wildcards for enums with unstable or hidden variants #7407redundant_allocation
: Now additionally supports the Arc<>
type #7308disallowed_names
: Now allows disallowed names in test code #7379redundant_closure
: Suggests &mut
for FnMut
#7437disallowed_methods
, disallowed_types
: The configuration values disallowed-method
and disallowed-type
no longer require fully qualified paths #7345zst_offset
: Fixed lint invocation after it was accidentally suppressed #7396default_numeric_fallback
: No longer lints on float literals as function arguments #7446use_self
: No longer lints on type parameters #7288unimplemented
: Now ignores the assert
and debug_assert
macros #7439branches_sharing_code
: Now always checks for block expressions #7462field_reassign_with_default
: No longer triggers in macros #7160redundant_clone
: No longer lints on required clones for borrowed data #7346default_numeric_fallback
: No longer triggers in external macros #7325needless_bool
: No longer lints in macros #7442useless_format
: No longer triggers when additional text is being appended #7442assertions_on_constants
: cfg!(...)
is no longer considered to be a constant #7319needless_collect
: Now show correct lint messages for shadowed values #7289wrong_pub_self_convention
: The deprecated message now suggest the correct configuration value #7382semicolon_if_nothing_returned
: Allow missing semicolon in blocks with only one expression #7326Released 2021-07-29
View all 74 merged pull requests
ref_binding_to_reference
#7105needless_bitwise_bool
#7133unused_async
#7225manual_str_repeat
#7265suspicious_splitn
#7292pub_enum_variant_names
and wrong_pub_self_convention
in favor of the new avoid-breaking-exported-api
config option (see Enhancements) #7187inconsistent_struct_constructor
to pedantic
#7193needless_borrow
to style
(now warn-by-default) #7254suspicious_operation_groupings
to nursery
#7266semicolon_if_nothing_returned
to pedantic
#7268while_let_on_iterator
: Now also lints in nested loops #6966single_char_pattern
: Now also lints on strip_prefix
and strip_suffix
#7156needless_collect
: Now also lints on assignments with type annotations #7163if_then_some_else_none
: Now works with the MSRV config #7177avoid-breaking-exported-api
config option for the lints enum_variant_names
, large_types_passed_by_value
, trivially_copy_pass_by_ref
, unnecessary_wraps
, upper_case_acronyms
, and wrong_self_convention
. We recommend to set this configuration option to false
before a major release (1.0/2.0/...) to clean up the API #7187needless_collect
: Now lints on even more data structures #7188missing_docs_in_private_items
: No longer sees #[<name> = "<value>"]
like attributes as sufficient documentation #7281needless_collect
, short_circuit_statement
, unnecessary_operation
: Now work as expected when used with allow
#7282implicit_return
: Now takes all diverging functions in account to avoid false positives #6951while_let_on_iterator
: No longer lints when the iterator is a struct field and the struct is used in the loop #6966multiple_inherent_impl
: No longer lints with generic arguments #7089comparison_chain
: No longer lints in a const
context #7118while_immutable_condition
: Fix false positive where mutation in the loop variable wasn't picked up #7144default_trait_access
: No longer lints in macros #7150needless_question_mark
: No longer lints when the inner value is implicitly dereferenced #7165unused_unit
: No longer lints when multiple macro contexts are involved #7167eval_order_dependence
: Fix false positive in async context #7174unnecessary_filter_map
: No longer lints if the filter_map
changes the type #7175wrong_self_convention
: No longer lints in trait implementations of non-Copy
types #7182suboptimal_flops
: No longer lints on powi(2)
#7201wrong_self_convention
: No longer lints if there is no implicit self
#7215option_if_let_else
: No longer lints on else if let
pattern #7216use_self
, useless_conversion
: Fix false positives when generic arguments are involved #7223manual_unwrap_or
: Fix false positive with deref coercion #7233similar_names
: No longer lints on wparam
/lparam
#7255redundant_closure
: No longer lints on using the vec![]
macro in a closure #7263implicit_return
#6951break
to return
when appropriatewhile_let_on_iterator
: Now suggests &mut iter
when necessary #6966match_single_binding
: Improve suggestion when match scrutinee has side effects #7095needless_borrow
: Now suggests to also change usage sites as needed #7105write_with_newline
: Improve suggestion when only \n
is written to the buffer #7183from_iter_instead_of_collect
: The suggestion is now auto applicable also when a <_ as Trait>::_
is involved #7264not_unsafe_ptr_arg_deref
: Improved error message #7294libstd
#7140implicit_return
#7242Released 2021-06-17
View all 126 merged pull requests
option_filter_map
#6342branches_sharing_code
#6463needless_for_each
#6706if_then_some_else_none
#6859non_octal_unix_permissions
#7001unnecessary_self_imports
#7072bool_assert_comparison
#7083cloned_instead_of_copied
#7098flat_map_option
#7101filter_map
lint #7059transmute_ptr_to_ptr
to pedantic
#7102mem_replace_with_default
: Also lint on common std constructors #6820wrong_self_convention
: Also lint on to_*_mut
methods #6828wildcard_enum_match_arm
, match_wildcard_for_single_variants
: #6863Option
and Result
Self
prefixexplicit_deref_methods
: Also lint on chained deref
calls #6865or_fun_call
: Also lint on unsafe
blocks #6928vec_box
, linkedlist
, option_option
: Also lint in const
and static
items #6938search_is_some
: Also check for is_none
#6942string_lit_as_bytes
: Also lint on into_bytes
#6959len_without_is_empty
: Also lint if function signatures of len
and is_empty
don't match #6980redundant_pattern_matching
: Also lint if the pattern is a &
pattern #6991clone_on_copy
: Also lint on chained method calls taking self
by value #7000missing_panics_doc
: Also lint on assert_eq!
and assert_ne!
#7029needless_return
: Also lint in async
functions #7067unused_io_amount
: Also lint on expressions like _.read().ok()?
#7100iter_cloned_collect
: Also lint on large arrays, since const-generics are now stable #7138upper_case_acronyms
: No longer lints on public items #6805suspicious_map
: No longer lints when side effects may occur inside the map
call #6831manual_map
, manual_unwrap_or
: No longer lints in const
functions #6917wrong_self_convention
: Now respects Copy
types #6924needless_question_mark
: No longer lints if the ?
and the Some(..)
come from different macro contexts #6935map_entry
: Better detect if the entry API can be used #6937or_fun_call
: No longer lints on some len
function calls #6950new_ret_no_self
: No longer lints when Self
is returned with different generic arguments #6952upper_case_acronyms
: No longer lints on public items #6981explicit_into_iter_loop
: Only lint when into_iter
is an implementation of IntoIterator
#6982expl_impl_clone_on_copy
: Take generic constraints into account before suggesting to use derive
instead #6993missing_panics_doc
: No longer lints when only debug-assertions are used #6996clone_on_copy
: Only lint when using the Clone
trait #7000wrong_self_convention
: No longer lints inside a trait implementation #7002redundant_clone
: No longer lints when the cloned value is modified while the clone is in use #7011same_item_push
: No longer lints if the Vec
is used in the loop body #7018cargo_common_metadata
: Remove author requirement #7026panic_in_result_fn
: No longer lints on debug_assert
family #7060panic
: No longer wrongfully lints on debug_assert
with message #7063wrong_self_convention
: No longer lints in trait implementations where no self
is involved #7064missing_const_for_fn
: No longer lints when unstable const
function is involved #7076suspicious_else_formatting
: Allow Allman style braces #7087inconsistent_struct_constructor
: No longer lints in macros #7097single_component_path_imports
: No longer lints on macro re-exports #7120redundant_pattern_matching
: Add a note when applying this lint would change the drop order #6568write_literal
, print_literal
: Add auto-applicable suggestion #6821manual_map
: Fix suggestion for complex if let ... else
chains #6856inconsistent_struct_constructor
: Make lint description and message clearer #6892map_entry
: Now suggests or_insert
, insert_with
or match _.entry(_)
as appropriate #6937manual_flatten
: Suggest to insert copied
if necessary #6962redundant_slicing
: Fix suggestion when a re-borrow might be required or when the value is from a macro call #6975match_wildcard_for_single_variants
: Fix suggestion for hidden variant #6988clone_on_copy
: Correct suggestion when the cloned value is a macro call #7000manual_map
: Fix suggestion at the end of an if chain #7004needless_collect
: Better explanation in the lint message #7020useless_vec
: Now considers mutability #7036useless_format
: Wrap the content in braces if necessary #7092single_match
: Don‘t suggest an equality check for types which don’t implement PartialEq
#7093from_over_into
: Mention type in help message #7099manual_unwrap_or
: Fix invalid code suggestion due to a macro call #7136rustc
now mention the new rustc
name in the deprecation warning #7056Released 2021-05-06
View all 102 merged pull requests
from_str_radix_10
#6717implicit_clone
#6730semicolon_if_nothing_returned
#6681manual_flatten
#6646inconsistent_struct_constructor
#6769iter_count
#6791default_numeric_fallback
#6662bytes_nth
#6695filter_map_identity
#6685manual_map
#6573upper_case_acronyms
to pedantic
#6775manual_map
to nursery
#6796unnecessary_wraps
to pedantic
#6765trivial_regex
to nursery
#6696naive_bytecount
to pedantic
#6825upper_case_acronyms
to style
#6788manual_map
to style
#6801disallowed_methods
: Now supports functions in addition to methods #6674upper_case_acronyms
: Added a new configuration upper-case-acronyms-aggressive
to trigger the lint if there is more than one uppercase character next to each other #6788collapsible_match
: Now supports block comparison with different value names #6754unnecessary_wraps
: Will now suggest removing unnecessary wrapped return unit type, like Option<()>
#6665use_self
: No longer lints in macros #6833use_self
: Fixed multiple false positives for: generics, associated types and derive implementations #6179missing_inline_in_public_items
: No longer lints for procedural macros #6814inherent_to_string
: No longer lints on functions with function generics #6771doc_markdown
: Add OpenDNS
to the default configuration as an allowed identifier #6783missing_panics_doc
: No longer lints on unreachable!
#6700collapsible_if
: No longer lints on if statements with attributes #6701match_same_arms
: Only considers empty blocks as equal if the tokens contained are the same #6843redundant_closure
: Now ignores macros #6871manual_map
: Fixed false positives when control flow statements like return
, break
etc. are used #6801vec_init_then_push
: Fixed false positives for loops and if statements #6697len_without_is_empty
: Will now consider multiple impl blocks and #[allow]
on the len
method as well as the type definition. #6853let_underscore_drop
: Only lints on types which implement Drop
#6682unit_arg
: No longer lints on unit arguments when they come from a path expression. #6601cargo_common_metadata
: No longer lints if publish = false
is defined in the manifest #6650collapsible_match
: Fixed lint message capitalization #6766or_fun_call
: Improved suggestions for or_insert(vec![])
#6790manual_map
: No longer expands macros in the suggestions #6801useless_format
: Improved the documentation example #6854README.md
: Includes a new subsection on running Clippy as a rustc wrapper #6782cargo clippy
after cargo check
now works as expected (cargo clippy
and cargo check
no longer shares the same build cache) #6687--
provided to cargo clippy
are changed. #6834utils
module into the new clippy_utils
crate #6756Released 2021-03-25
View all 78 merged pull requests
upper_case_acronyms
#6475from_over_into
#6476case_sensitive_file_extension_comparisons
#6500needless_question_mark
#6507missing_panics_doc
#6523redundant_slicing
#6528vec_init_then_push
#6538ptr_as_ptr
#6542collapsible_else_if
(split out from collapsible_if
) #6544inspect_for_each
#6577manual_filter_map
#6591exhaustive_enums
#6617exhaustive_structs
#6617find_map
with manual_find_map
#6591unknown_clippy_lints
Now integrated in the unknown_lints
rustc lint #6653ptr_arg
Now also suggests to use &Path
instead of &PathBuf
#6506cast_ptr_alignment
Also lint when the pointer::cast
method is used #6557collapsible_match
Now also deals with &
and *
operators in the match
scrutinee #6619similar_names
Ignore underscore prefixed names #6403print_literal
and write_literal
No longer lint numeric literals #6408large_enum_variant
No longer lints in external macros #6485empty_enum
Only lint if never_type
feature is enabled #6513field_reassign_with_default
No longer lints in macros #6553size_of_in_element_count
No longer lints when dividing by element size #6578needless_return
No longer lints in macros #6586match_overlapping_arm
No longer lint when first arm is completely included in second arm #6603doc_markdown
Add WebGL
to the default configuration as an allowed identifier #6605field_reassign_with_default
Don't expand macro in lint suggestion #6531match_like_matches_macro
Strip references in suggestion #6532single_match
Suggest if
over if let
when possible #6574ref_in_deref
Use parentheses correctly in suggestion #6609stable_sort_primitive
Clarify error message #6611README.md
by removing outdated paragraph #6488await_holding_refcell_ref
and await_holding_lock
#6585as_conversions
#6608CLIPPY_TESTS=true
was set somewhere #6575cargo dev-lintcheck
tool to the Clippy Dev Tool #6469Released 2021-02-11
View all 119 merged pull requests
suspicious_operation_groupings
#6086size_of_in_element_count
#6394unnecessary_wraps
#6070let_underscore_drop
#6305collapsible_match
#6402redundant_else
#6330zero_sized_map_values
#6218print_stderr
#6367string_from_utf8_as_bytes
#6134str_to_string
and string_to_string
have been un-deprecated as restriction
lints #6333panic_params
lint. This is now available in rustc as non_fmt_panics
#6351map_err_ignore
to restriction
#6416await_holding_refcell_ref
to pedantic
#6354await_holding_lock
to pedantic
#6354unreadable-literal-lint-fractions
configuration to disable the unreadable_literal
lint for fractions #6421clone_on_copy
: Now shows the type in the lint message #6443redundant_pattern_matching
: Now also lints on std::task::Poll
#6339redundant_pattern_matching
: Additionally also lints on std::net::IpAddr
#6377search_is_some
: Now suggests contains
instead of find(foo).is_some()
#6119clone_double_ref
: Now prints the reference type in the lint message #6442modulo_one
: Now also lints on -1. #6360empty_loop
: Now lints no_std crates, too #6205or_fun_call
: Now also lints when indexing HashMap
or BTreeMap
#6267wrong_self_convention
: Now also lints in trait definitions #6316needless_borrow
: Print the type in the lint message #6449manual_range_contains
: No longer lints in const fn
#6382unnecessary_lazy_evaluations
: No longer lints if closure argument is used #6370match_single_binding
: Now ignores cases with #[cfg()]
macros #6435match_like_matches_macro
: No longer lints on arms with attributes #6290map_clone
: No longer lints with deref and clone #6269map_clone
: No longer lints in the case of &mut #6301needless_update
: Now ignores non_exhaustive
structs #6464needless_collect
: No longer lints when a collect is needed multiple times #6313unnecessary_cast
No longer lints cfg-dependent types #6369declare_interior_mutable_const
and borrow_interior_mutable_const
: Both now ignore enums with frozen variants #6110field_reassign_with_default
No longer lint for private fields #6537vec_box
: Provide correct type scope suggestion #6271manual_range_contains
: Give correct suggestion when using floats #6320unnecessary_lazy_evaluations
: Don't always mark suggestion as MachineApplicable #6272manual_async_fn
: Improve suggestion formatting #6294unnecessary_cast
: Fix incorrectly formatted float literal suggestion #6362from_iter_instead_of_collect
#6304needless_doctest_main
#6458missing-errors-doc
and missing errors doc
are now valid aliases for lint namescomparison_chain
documentation #6390cargo_common_metadata
#6293map_clone
documentation #6340--no-deps
option to avoid running on path dependencies in workspaces #6188Released 2020-12-31
View all 107 merged pull requests
field_reassign_with_default
#5911await_holding_refcell_ref
#6029disallowed_methods
#6081inline_asm_x86_att_syntax
#6092inline_asm_x86_intel_syntax
#6092from_iter_instead_of_collect
#6101mut_mutex_lock
#6103single_element_loop
#6109manual_unwrap_or
#6123large_types_passed_by_value
#6135result_unit_err
#6157ref_option_ref
#6165manual_range_contains
#6177unusual_byte_groupings
#6183comparison_to_empty
#6226map_collect_result_unit
#6227manual_ok_or
#6233single_char_push_str
to single_char_add_str
#6037zero_width_space
to invisible_characters
#6105drop_bounds
(uplifted) #6111string_lit_as_bytes
to nursery
#6117rc_buffer
to restriction
#6128manual_memcpy
: Also lint when there are loop counters (and produce a reliable suggestion) #5727single_char_add_str
: Also lint on String::insert_str
#6037invisible_characters
: Also lint the characters \u{AD}
and \u{2060}
#6105eq_op
: Also lint on the assert_*!
macro family #6167items_after_statements
: Also lint in local macro expansions #6176unnecessary_cast
: Also lint casts on integer and float literals #6187manual_unwrap_or
: Also lint Result::unwrap_or
#6190match_like_matches_macro
: Also lint when match
has more than two arms #6216integer_arithmetic
: Better handle /
an %
operators #6229needless_lifetimes
: Bail out if the function has a where
clause with the lifetime #5978explicit_counter_loop
: No longer lints, when loop counter is used after it is incremented #6076or_fun_call
: Revert changes addressing the handling of const fn
#6077needless_range_loop
: No longer lints, when the iterable is used in the range #6102inconsistent_digit_grouping
: Fix bug when using floating point exponent #6104mistyped_literal_suffixes
: No longer lints on the fractional part of a float (e.g. 713.32_64
) #6114invalid_regex
: No longer lint on unicode characters within bytes::Regex
#6132boxed_local
: No longer lints on extern fn
arguments #6133needless_lifetimes
: Fix regression, where lifetime is used in where
clause #6198unnecessary_sort_by
: Avoid dereferencing the suggested closure parameter #6078needless_arbitrary_self_type
: Correctly handle expanded code #6093useless_format
: Preserve raw strings in suggestion #6151empty_loop
: Suggest alternatives #6162borrowed_box
: Correctly add parentheses in suggestion #6200unused_unit
: Improve suggestion formatting #6247doc_markdown
: Document problematic link text style #6107Released 2020-11-19
View all 99 merged pull requests
self_assignment
#5894unnecessary_lazy_evaluations
#5720manual_strip
#6038map_err_ignore
#5998rc_buffer
#6044to_string_in_display
#5831single_char_push_str
#5881verbose_bit_mask
to pedantic #6036precedence
to handle chains of methods combined with unary negation #5928useless_vec
: add a configuration value for the maximum allowed size on the stack #5907suspicious_arithmetic_impl
: extend to implementations of BitAnd
, BitOr
, BitXor
, Rem
, Shl
, and Shr
#5884invalid_atomic_ordering
: detect misuse of compare_exchange
, compare_exchange_weak
, and fetch_update
#6025redundant_pattern_matching
triggering in macros #6069option_if_let_else
: distinguish pure from impure else
expressions #5937needless_doctest_main
: parse doctests instead of using textual search #5912wildcard_imports
: allow prelude
to appear in any segment of an import #5929len_zero
for ranges now that range_is_empty
is stable #5961option_as_ref_deref
: catch fully-qualified calls to Deref::deref
and DerefMut::deref_mut
#5933useless_attribute
: permit allowing wildcard_imports
and enum_glob_use
#5994transmute_ptr_to_ptr
: avoid suggesting dereferencing raw pointers in const contexts #5999redundant_closure_call
: take into account usages of the closure in nested functions and closures #5920borrow_interior_mutable_const
when referencing a field behind a pointer #5949doc_markdown
: allow using “GraphQL” without backticks #5996to_string_in_display
: avoid linting when calling to_string()
on anything that is not self
#5971indexing_slicing
and out_of_bounds_indexing
treat references to arrays as arrays #6034should_implement_trait
: ignore methods with lifetime parameters #5725needless_return
: avoid linting if a temporary borrows a local variable #5903unnecessary_sort_by
to non-reference, Copy types #6006from_bits
/to_bits
in const contexts in transmute_int_to_float
#5919declare_interior_mutable_const
and borrow_interior_mutable_const
: improve detection of interior mutable types #6046let_and_return
: add a cast to the suggestion when the return expression has adjustments #5946useless_conversion
: show the type in the error message #6035unnecessary_mut_passed
: discriminate between functions and methods in the error message #5892float_cmp
and float_cmp_const
: change wording to make margin of error less ambiguous #6043default_trait_access
: do not use unnecessary type parameters in the suggestion #5993collapsible_if
: don't use expanded code in the suggestion #5992print_with_newline
and write_with_newline
#6042unit_arg
: improve the readability of the suggestion #5931stable_sort_primitive
: print the type that is being sorted in the lint message #5935too_many_lines
lint message #6009useless_conversion
where applicable #5900option_map_unit_fn
and result_map_unit_fn
: print the unit type ()
explicitly #6024redundant_allocation
: suggest replacing Rc<Box<T>>
with Rc<T>
#5899repeat_once
#5948mutable_key_type
: explain potential for false positives when the interior mutable type is not accessed in the Hash
implementation #6019unnecessary_mut_passed
: fix typo #5913ptr_arg
docs. #5885box_vec
, vec_box
and borrowed_box
: add link to the documentation of Box
#6023Released 2020-10-08
View all 76 merged pull requests
derive_ord_xor_partial_ord
#5848trait_duplication_in_bounds
#5852map_identity
#5694unit_return_expecting_ord
#5737pattern_type_mismatch
#4841repeat_once
#5773same_item_push
#5825needless_arbitrary_self_type
#5869match_like_matches_macro
#5769stable_sort_primitive
#5809blanket_clippy_restriction_lints
#5750option_if_let_else
#5301regex_macro
lint #5760range_minus_one
to pedantic
#5752needless_collect
by catching collect
calls followed by iter
or into_iter
calls #5837panic
, todo
, unimplemented
and unreachable
now detect calls with formatting #5811suboptimal_flops
and imprecise_flops
#5443PartialEq
in cmp_owned
#5701unsafe_derive_deserialize
#5870ord.min(a).max(b)
where a < b in min_max
#5871clone_on_copy
suggestion machine applicable #5745len_zero
on ranges now that is_empty
is stable on them #5961or_fun_call
with const fns that take no arguments #5889redundant_closure_call
false positive for closures that have multiple calls #5800ManuallyDrop
in redundant_clone
#5824single_match_else
#5771unnested_or_patterns
if the feature or_patterns
is not enabled #5758unnecessary_sort_by
#5756Try
impl for Poll
when generating suggestions in try_err
#5857manual_async_fn
#5859type_repetition_in_bounds
and add a configuration option #5761suspicious_arithmetic_impl
lint to one binary operation #5820shadow_unrelated
suggestion by truncating the RHS snippet #5788filter_map
instead of flat_map
when mapping to Option
in map_flatten
#5846iter_nth_zero
#5793redundant_pattern_matching
#5815iter_skip_next
#5843collapsible_if
fix suggestion #5732needless_collect
#5877unnested_or_patterns
#5784await_holding_lock
documentation #5748Released 2020-08-27
View all 48 merged pull requests
cast_ptr_alignment
to pedantic #5667mem_replace_with_uninit
lint #5695len_zero
: Avoid linting ranges when the range_is_empty
feature is not enabled #5656let_and_return
: Don't lint if a temporary borrow is involved #5680reversed_empty_ranges
: Avoid linting N..N
in for loop arguments in #5692if_same_then_else
: Don't assume multiplication is always commutative #5702disallowed_names
: Remove bar
from the default configuration #5712redundant_pattern_matching
: Avoid suggesting non-const fn
calls in const contexts #5724unit_arg
lint, so that it suggest semantic equivalent code #4455macro_use_imports
#5279consts
module of Clippy #5709--rustc
flag to clippy-driver
, which turns clippy-driver
into rustc
and passes all the given arguments to rustc
. This is especially useful for tools that need the rustc
version Clippy was compiled with, instead of the Clippy version. E.g. clippy-driver --rustc --version
will print the output of rustc --version
. #5178Released 2020-07-16
View all 81 merged pull requests
match_wildcard_for_single_variants
#5582unsafe_derive_deserialize
#5493if_let_mutex
#5332mismatched_target_os
#5506await_holding_lock
#5439match_on_vec_items
#5522manual_async_fn
#5576reversed_empty_ranges
#5583manual_non_exhaustive
#5550match_bool
to pedantic #5408match_wild_err_arm
to pedantic and update help messages. #5622useless_let_if_seq
to nursery. #5599option_and_then_some
and rename to bind_instead_of_map
. #5529identity_conversion
to useless_conversion
. #5568block_in_if_condition_expr
and block_in_if_condition_stmt
into blocks_in_if_conditions
. #5563option_map_unwrap_or
, option_map_unwrap_or_else
and result_map_unwrap_or_else
into map_unwrap_or
. #5563option_unwrap_used
and result_unwrap_used
into unwrap_used
. #5563option_expect_used
and result_expect_used
into expect_used
. #5563for_loop_over_option
and for_loop_over_result
into for_loops_over_fallibles
. #5563useless_conversion
with TryFrom
and TryInto
. #5631unused_unit
. #5592Default
in new_without_default
. #5616while_let_on_iterator
#5525empty_line_after_outer_attr
#5609unnecessary_unwrap
#5558comparison_chain
#5596used_underscore_binding
in await desugaring. #5535borrowed_box
on mutable references. #54911 << 0
in identity_op
. #5602use super::*;
glob imports in wildcard_imports
. #5564doc_markdown
. #5611multiple_crate_versions
. #5636allow
attribute on arguments in ptr_arg
. #5647redundant_field_names
, just_underscores_and_digits
, many_single_char_names
and similar_names
. #5651len
in or_fun_call
. #4429manual_memcpy
. #5536redundant_pattern_matching
for macros. #5511copied()
for mutable references in map_clone
. #5530clone_double_ref
. #5547unnecessary_mut_passed
. #5639unneeded_field_pattern
. #5541Released 2020-06-04
View all 124 merged pull requests
explicit_deref_methods
#5226implicit_saturating_sub
#5427macro_use_imports
#5230verbose_file_reads
#5272future_not_send
#5423redundant_pub_crate
#5319large_const_arrays
#5248result_map_or_into_option
#5415redundant_allocation
#5349fn_address_comparisons
#5294vtable_address_comparisons
#5294replace_consts
lint #5380cognitive_complexity
to nursery #5428useless_transmute
to nursery #5364inefficient_to_string
to pedantic #5412option_option
to pedantic #5401unreadable_literal
to pedantic #5419let_unit_value
to pedantic #5409trivially_copy_pass_by_ref
to pedantic #5410implicit_hasher
to pedantic #5411cargo clippy --fix -Z unstable-options
to auto-fix lints that support this #5363redundant_clone
also trigger on cases where the cloned value is not consumed. #5304integer_arithmetic
to also disallow bit-shifting #5430option_as_ref_deref
now detects more deref cases #5425large_enum_variant
now report the sizes of the largest and second-largest variants #5466bool_comparison
now also checks for inequality comparisons that can be written more concisely #5365clone_on_copy
to work in method call arguments as well #5441redundant_pattern_matching
now also handles while let
#5483integer_arithmetic
now also lints references of integers #5329float_cmp_const
to also work on arrays #5345map_flatten
when map is called on an Option
#5473many_single_char_names
#5468should_implement_trait
#5437unused_self
#5387redundant_clone
#5453precedence
#5445suspicious_op_assign_impl
#5424needless_lifetimes
#5293redundant_pattern
#5287inconsistent_digit_grouping
#5451question_mark
lint suggestion so that it doesn't add redundant as_ref()
#5481option_map_unit_fn
#5292match_single_binding
when triggered inside a closure #5350new_ret_no_self
#5448option_option
now suggest using a tri-state enum #5403verbose_bit_mask
documentation #5454wildcard_imports
documentation now mentions that use ...::prelude::*
is not linted #5312Released 2020-04-23
View all 91 merged pull requests
imprecise_flops
#4897suboptimal_flops
#4897wildcard_imports
#5029single_component_path_imports
#5058match_single_binding
#5061let_underscore_lock
#5101struct_excessive_bools
#5125fn_params_excessive_bools
#5125option_env_unwrap
#5148lossy_float_literal
#5202rest_pat_in_fully_bound_structs
#5258unneeded_field_pattern
to pedantic group #5200missing_errors_doc
lint also trigger on async
functions #5181approx_constant
#5193question_mark
lint #5266misc_early
lints #5129missing_errors_doc
#5213usize
s #5256iter_nth_zero
Released 2020-03-12
View all 101 merged pull requests
filetype_is_file
#4543let_underscore_must_use
#4823modulo_arithmetic
#4867mem_replace_with_default
#4881mutable_key_type
#4885option_as_ref_deref
#4945wildcard_in_or_patterns
#4960iter_nth_zero
#4966invalid_atomic_ordering
#4999skip_while_next
#5067transmute_float_to_int
from nursery to complexity group #5015range_plus_one
to pedantic group #5057debug_assert_with_mut_call
to nursery group #5106unused_label
#4930unused_io_amount
#5027vec_box
configurable by adding a size threshold #5081cmp_nan
#4910expect_fun_call
#4915redundant_clone
#5017map_clone
#4937replace_consts
#4977let_and_return
#5008eq_op
#5079possible_missing_comma
#5083debug_assert_with_mut_call
#5106let_underscore_must_use
in external macros #5082empty_loop
in no_std
crates #5086option_map_unwrap_or
#4634wildcard_enum_match_arm
#4934cognitive_complexity
#4935decimal_literal_representation
#4956unknown_clippy_lints
#4963explicit_into_iter_loop
#4978useless_attribute
#5022if_let_some_result
#5032empty_enum
, replace_consts
, redundant_clone
, and iterator_step_by_zero
Released 2020-01-30
View all 74 merged pull requests
use_self
to nursery group #4863into_iter_on_array
#4788string_lit_as_bytes
to also trigger when literal has escapes #4808comparison_chain
#4842while_immutable_condition
#4730explicit_counter_loop
#4803must_use_candidate
#4794print_with_newline
and write_with_newline
#4769derive_hash_xor_eq
#4766missing_inline_in_public_items
#4870string_add
#4880float_arithmetic
#4851cast_sign_loss
#4883manual_swap
#4877use_self
#4776const_generics
#4780clippy-driver
without arguments, instead of ICEing #4810Released 2019-12-19
View all 76 merged pull requests
unneeded_wildcard_pattern
#4537needless_doctest_main
#4603suspicious_unary_op_formatting
#4615debug_assert_with_mut_call
#4680unused_self
#4619inefficient_to_string
#4683must_use_unit
#4560must_use_candidate
#4560double_must_use
#4560comparison_chain
#4569unsound_collection_transmute
#4592panic
#4657unreachable
#4657todo
#4657option_expect_used
#4657result_expect_used
#4657redundant_clone
to perf group #4509manual_mul_add
to nursery group #4736unit_cmp
to also work with assert_eq!
, debug_assert_eq!
, assert_ne!
and debug_assert_ne!
#4613integer_arithmetic
to also detect mutating arithmetic like +=
#4585nonminimal_bool
#4568missing_safety_doc
#4611cast_sign_loss
#4614redundant_clone
#4509try_err
#4721toplevel_ref_arg
#4570multiple_inherent_impl
#4593cargo fix --clippy
#4575zero_ptr
#4599explicit_counter_loop
#4691mul_add
#4602assertions_on_constants
#4635use_self
#4671Released 2019-11-07
View all 100 merged pull requests
unused_collect
lint. This is fully covered by rustc's #[must_use]
on collect
#4348type_repetition_in_bounds
to pedantic group #4403cast_lossless
to pedantic group #4539temporary_cstring_as_ptr
now catches more cases #4425use_self
now works in constructors, too #4525cargo_common_metadata
now checks for license files #4518cognitive_complexity
now includes the measured complexity in the warning message #4469block_in_if_*
lints #4458cast_lossless
#4473clone_on_copy
#4411deref_addrof
#4487too_many_lines
#4490new_ret_no_self
#4365manual_swap
#4478missing_const_for_fn
#4450extra_unused_lifetimes
#4477inherent_to_string
#4460map_entry
#4495unused_unit
#4445redundant_pattern
#4489wrong_self_convention
#4369cargo fix --clippy
#4558redundant_pattern_matching
#4352explicit_write
#4544or_fun_call
#4522match_as_ref
#4446unnecessary_fold_span
#4382unseparated_literal_suffix
#4401char_lit_as_u8
#4418Released 2019-09-26
View all 76 merged pull requests
{unnecessary,panicking}_unwrap
out of nursery #4307use_self
lint to suggest uses of Self::Variant
#4308let_unit
#4337pub_enum_variant_names
and enum_variant_names
#4345cast_ptr_alignment
#4257string_lit_as_bytes
#4233needless_lifetimes
#4266float_cmp
#4275needless_return
#4274match_same_arms
#4246needless_bool
#4335cast_ptr_alignment
#4257single_char_literal
#4361len_zero
#4314implicit_hasher
#4268trivially_copy_pass_by_ref
#4250Released 2019-08-15
View all 72 merged pull requests
const_static_lifetime
is now called redundant_static_lifetimes
. The lint now covers statics in addition to consts #4162match_same_arms
now warns for all identical arms, instead of only the first one #4102needless_return
now works with void functions #4220redundant_closure
#4190useless_attribute
#4107float_cmp
#4214print_with_newline
and write_with_newline
#4136option_map_unwrap_or_else
and result_map_unwrap_or_else
#4164non_ascii_literal
#4119let_and_return
#4137trivially_copy_pass_by_ref
#4071unreadable_literal
#4099Released 2019-07-04
View all 81 merged pull requests
find_map
, filter_map_next
#4039path_buf_push_overwrite
#3954path_buf_push_overwrite
to the nursery #4013redundant_closure
into redundant_closure
and redundant_closure_for_method_calls
#4110toplevel_ref_arg
lint #4007or_fun_call
pertaining to nested constructors #4084or_fun_call
pertaining to enum variant constructors #4018useless_let_if_seq
pertaining to interior mutability #4035redundant_closure
pertaining to non-function types #4008let_and_return
pertaining to attributes on let
s #4024module_name_repetitions
lint pertaining to attributes #4006assertions_on_constants
pertaining to debug_assert!
#3989map_clone
to suggest .copied()
where applicable #3970 #4043search_is_some
#4049naive_bytecount
#3984while_let_loop
#3975too_many_arguments
#4053cast_lossless
#4021unnecessary_cast
#4026approx_constant
‘s documentation’s “Known problems” section. #4027suspicious_else_formatting
#3960decimal_literal_representation
#3931Released 2019-05-20
drop_bounds
to detect T: Drop
boundsredundant_closure
into redundant_closure
and redundant_closure_for_method_calls
#4110cyclomatic_complexity
to cognitive_complexity
, start work on making lint more practical for Rust codeget_unwrap
to the restriction categoryiter_cloned_collect
cast_lossless
to suggest suffixed literalsprint_with_newline
and write_with_newline
pertaining to raw stringsneedless_range_loop
pertaining to structs without a .iter()
bool_comparison
pertaining to non-bool typesredundant_closure
pertaining to differences in borrowsoption_map_unwrap_or
on non-copy typesmissing_const_for_fn
pertaining to macros and trait method implsneedless_pass_by_value
pertaining to procedural macrosneedless_continue
pertaining to loop labelsboxed_local
pertaining to arguments moved into closuresuse_self
in nested functionsexpect_fun_call
(https://github.com/rust-lang/rust-clippy/pull/3846)explicit_counter_loop
to deal with parenthesizing range variablessingle_char_pattern
to correctly escape single quotesredundant_closure
in macrosReleased 2019-04-10
View all 61 merged pull requests
assertions_on_constants
to detect for example assert!(true)
dbg_macro
to detect uses of the dbg!
macromissing_const_for_fn
that can suggest functions to be made const
too_many_lines
to detect functions with excessive LOC. It can be configured using the too-many-lines-threshold
configuration.wildcard_enum_match_arm
to check for wildcard enum matches using _
redundant_closure
to also work for methods (not only functions)vec_box
, needless_pass_by_value
and implicit_hasher
cast_sign_loss
integer_arithmetic
unit_arg
implicit_return
explicit_write
question_mark
lintcast_lossless
expect_fun_call
needless_bool
needless_range_loop
use_self
while_let_on_iterator
Released 2019-02-26
View all 120 merged pull requests
implicit_return
, vec_box
, cast_ref_to_mut
rust-clippy
repository is now part of the rust-lang
org.stutter
to module_name_repetitions
new_without_default_derive
into new_without_default
lintlarge_digit_groups
from style
group to pedantic
bool_comparison
to check for <
, <=
, >
, >=
, and !=
comparisons against booleansno_effect
to detect writes to constants such as A_CONST.field = 2
redundant_clone
to work on struct fieldssuspicious_else_formatting
to detect if .. {..} {..}
use_self
to work on tuple structs and also in local macrosresult_map_unit_fn
and option_map_unit_fn
implicit_return
use_self
clone_on_copy
doc_markdown
empty_loop
if_same_then_else
infinite_iter
question_mark
useless_asref
wildcard_dependencies
write_with_newline
explicit_write
question_mark
lintget_unwrap
Released 2019-01-17
View all 71 merged pull requests
slow_vector_initialization
, mem_discriminant_non_enum
, redundant_clone
, wildcard_dependencies
, into_iter_on_ref
, into_iter_on_array
, deprecated_cfg_attr
, cargo_common_metadata
u128
and i128
to integer related lintsmistyped_literal_suffixes
use_self
missing_comma
new_ret_no_self
possible_missing_comma
integer_arithmetic
in constant itemsneedless_borrow
out_of_bounds_indexing
new_without_default_derive
string_lit_as_bytes
out_of_bounds_indexing
use_self
. It will now also check existential typesredundant_closure_call
bool_comparison
triggering 3 times on on on the same codetrivially_copy_pass_by_ref
to work on trait methodsneedless_range_loop
needless_pass_by_value
from pedantic
group to style
Released 2018-12-06
rustup component add clippy
.redundant_pattern_matching
, unnecessary_filter_map
, unused_unit
, map_flatten
, mem_replace_option_with_none
if_let_redundant_pattern_matching
needless_pass_by_value
when encountering a generic function argument with a lifetime parameterneedless_range_loop
single_char_pattern
when encountering a constant valueassign_op_pattern
boxed_local
on trait implementationscmp_owned
collapsible_if
when conditionals have commentsdouble_parens
excessive_precision
explicit_counter_loop
fn_to_numeric_cast_with_truncation
map_clone
new_ret_no_self
new_without_default
when new
is unsafetype_complexity
when using extern typesuseless_format
wrong_self_convention
excessive_precision
expect_fun_call
get_unwrap
useless_format
fn_to_numeric_cast_with_truncation
lint can be disabled againmanual_memcpy
needless_lifetimes
Released 2018-10-25
View all 88 merged pull requests
assign_ops
lintmistyped_literal_suffixes
, ptr_offset_with_cast
, needless_collect
, copy_iterator
cargo clippy -V
now includes the Clippy commit hash of the Rust Clippy componentimplicit_hasher
println!("{}" a);
default_trait_access
trivially_copy_pass_by_ref
similar_names
redundant_field_name
expect_fun_call
identity_conversion
explicit_counter_loop
range_plus_one
suggestion and false negativeprint_with_newline
/ write_with_newline
: don't warn about string with several \n
s in themuseless_attribute
to also whitelist unused_extern_crates
single_char_pattern
identity_conversion
lintexplicit_iter_loop
and explicit_into_iter_loop
from style
group to pedantic
range_plus_one
and range_minus_one
from nursery
group to complexity
shadow_unrelated
from restriction
group to pedantic
indexing_slicing
from pedantic
group to restriction
Released 2018-09-13
rustup component add clippy-preview
and then cargo clippy
to run Clippy. This should put an end to the continuous nightly upgrades for Clippy users.while let (..) = x.iter()
constructuse_self
trivially_copy_pass_by_ref
useless_attribute
lintprint_literal
use_self
regressionsneg_cmp_op_on_partial_ord
single_char_pattern
unused_lifetimes
to extra_unused_lifetimes
because of naming conflict with new rustc lintclippy::cyclomatic_complexity
instead of clippy(cyclomatic_complexity)
cast_ptr_alignment
, transmute_ptr_to_ptr
, write_literal
, write_with_newline
, writeln_empty_string
print_literal
while_immutable_condition
redundant_field_names
, suspicious_arithmetic_impl
, suspicious_op_assign_impl
question_mark
double_comparisons
, empty_line_after_outer_attr
misaligned_transmute
decimal_literal_representation
else_if_without_else
, option_option
, unit_arg
, unnecessary_fold
unit_expr
needless_pass_by_value
match_as_ref
just_underscores_and_digits
, result_map_unwrap_or_else
, transmute_bytes_to_str
const_static_lifetime
, erasing_op
, fallible_impl_from
, println_empty_string
, useless_asref
explicit_write
, identity_conversion
, implicit_hasher
, invalid_ref
, option_map_or_none
, range_minus_one
, range_plus_one
, transmute_int_to_bool
, transmute_int_to_char
, transmute_int_to_float
mut_range_bound
int_plus_one
chars_last_cmp
needless_borrow
, ptr_arg
,clone_on_ref_ptr
manual_memcpy
cast_lossless
no longer has redundant parentheses in its suggestionsunit_expr
infinite_iter
, maybe_infinite_iter
, cast_lossless
use_self
triggering inside derivescargo clippy --all
naive_bytecount
use_self
unreadable_literal
, inconsistent_digit_grouping
, large_digit_groups
inline_always
panic_params
cargo clippy
crashing on dylib
projectsnested_while_let
and never_loop
doc_markdown
lint.range_step_by_zero
iterator_step_by_zero
needless_borrowed_reference
AsRef
/AsMut
arguments in wrong_self_convention
needless_continue
op_ref
cargo clippy
on 64 bit windows systemszero_ptr
, never_loop
, mut_from_ref
large_enum_variant
explicit_into_iter_loop
provides suggestionsCargo.toml
&&mut
by &ref
for (_, x) in &mut hash_map
-> for x in hash_map.values_mut()
unused_io_amount
, forget_ref
, short_circuit_statement
wrong_self_convention
deref_addrof
, double_parens
, pub_enum_variant_names
new_without_default
absurd_extreme_comparisons
string_extend_chars
get_unwrap
--sysroot
, which broke cargo clippy
cargo clippy
defines a cargo-clippy
feature. This was previously added for a short time under the name clippy
but removed for compatibility.cargo clippy --help
is more helping (and less helpful :smile:)if_let_redundant_pattern_matching
, partialeq_ne_impl
iter_skip_next
option_map_unwrap_or
and option_map_unwrap_or_else
are now allowed by default.explicit_into_iter_loop
clippy
lint groups: filter_next
, for_loop_over_option
, for_loop_over_result
and match_overlapping_arm
. You should now be able to #[allow/deny]
them individually and they are available directly through cargo clippy
.builtin_type_shadow
zero_prefixed_literal
and 0b
/0o
missing_docs_in_private_items
, zero_prefixed_literal
useless_attribute
useless_attribute
ignores unused_imports
on use
statementsprint_with_newline
, useless_attribute
module_inception
eval_order_dependence
, mixed_case_hex_literals
, unseparated_literal_suffix
too_many_arguments
needless_borrow
clone_on_copy
wrong_self_convention
misrefactored_assign_op
, serde_api_misuse
wrong_transmute
, double_neg
, filter_map
cargo clippy
does not defines the clippy
feature introduced in 0.0.76 anymorecollapsible_if
now considers if let
stutter
and iter_nth
cargo clippy
now automatically defines the clippy
featurenot_unsafe_ptr_arg_deref
cargo-clippy
JSON parsingCLIPPY_DISABLE_DOCS_LINKS
environment variable to deactivate the “for further information visit lint-link” message.useless_let_if_seq
useless_let_if_seq
useless_let_if_seq
invalid_regex
and trivial_regex
can now warn on RegexSet::new
, RegexBuilder::new
and byte regexesused_underscore_binding
has been made Allow
temporarilyunnecessary_operation
cargo clippy
subcommandassign_op_pattern
, assign_ops
, needless_borrow
float_arithmetic
, integer_arithmetic
temporary_cstring_as_ptr
, unsafe_removed_from_name
, and mem_forget
invalid_upcast_comparisons
logic_bug
, nonminimal_bool
match_same_arms
now ignores arms with guardsuseless_vec
now warns on for … in vec![…]
doc_markdown
str_to_string
, string_to_string
, unstable_as_slice
, unstable_as_mut_slice
crosspointer_transmute
many_single_char_names
and similar_names
str
to types considered by len_zero
indexing_slicing
overflow_check_conditional
, unused_label
, new_without_default
needless_range_loop
with globalsredundant_closure_call