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 2022-09-22
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
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
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
only_used_in_recursion
#8422cast_enum_truncation
#8381missing_spin_loop
#8174deref_by_slicing
#8218needless_match
#8471allow_attributes_without_reason
(Requires #![feature(lint_reasons)]
) #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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
{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
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
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
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
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
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
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