Implement lint for regex::Regex compilation inside a loop Closes #598. Seems like a pretty simple one, I'm not sure if I sorted out all the lint plumbing correctly because I was adding it to the existing regex pass, but seems to work. The name is a bit jank and I'm super open to suggestions for changing it. changelog: [`regex_creation_in_loops`]: Added lint for Regex compilation inside loops.
352 KiB
Changelog
All notable changes to this project will be documented in this file. See Changelog Update if you want to update this document.
Unreleased / Beta / In Rust Nightly
Rust 1.81
Current stable, released 2024-09-05
New Lints
- Added
cfg_not_test
torestriction
#11293 - Added
byte_char_slices
tostyle
#10155 - Added
set_contains_or_insert
tonursery
#12873 - Added
manual_rotate
tostyle
#12983 - Added
unnecessary_min_or_max
tocomplexity
#12368 - Added
manual_inspect
tocomplexity
#12287 - Added
field_scoped_visibility_modifiers
torestriction
#12893 - Added
manual_pattern_char_comparison
tostyle
#12849 - Added
needless_maybe_sized
tosuspicious
#10632 - Added
needless_character_iteration
tosuspicious
#12815
Moves and Deprecations
allow_attributes
,allow_attributes_without_reason
: Now work on stable rust#120924- Renamed
overflow_check_conditional
topanicking_overflow_checks
#12944 - Moved
panicking_overflow_checks
tocorrectness
(Fromcomplexity
now deny-by-default) #12944 - Renamed
thread_local_initializer_can_be_made_const
tomissing_const_for_thread_local
#12974 - Deprecated
maybe_misused_cfg
andmismatched_target_os
as they are now caught by cargo and rustc #12875
Enhancements
significant_drop_in_scrutinee
: Now also checks scrutinies ofwhile let
andfor let
expressions #12870std_instead_of_core
: Now respects themsrv
configuration #13168
ICE Fixes
suboptimal_flops
: No longer crashes on custom.log()
functions #12884
Rust 1.80
Current stable, released 2024-07-25
View all 68 merged pull requests
New Lints
- Added
while_float
tonursery
#12765 - Added
macro_metavars_in_unsafe
tosuspicious
#12107 - Added
renamed_function_params
torestriction
#11540 - Added
doc_lazy_continuation
tostyle
#12770
Moves and Deprecations
- Moved
assigning_clones
topedantic
(Fromperf
now allow-by-default) #12779 - Moved
single_char_pattern
topedantic
(Fromperf
now allow-by-default) #11852
Enhancements
panic
: Addedallow-panic-in-tests
configuration to allow the lint in tests #12803missing_const_for_fn
: Now respects themsrv
configuration #12713missing_panics_doc
: No longer lints on compile-time panics #12790collapsible_match
: Now considers themsrv
configuration for the suggestion #12745useless_vec
: Addedallow-useless-vec-in-tests
configuration to allow the lint in tests #12725
Suggestion Fixes/Improvements
single_match
,single_match_else
: Suggestions are now machine-applicable #12726
Rust 1.79
Released 2024-06-13
View all 102 merged pull requests
New Lints
- Added
legacy_numeric_constants
tostyle
#12312 - Added
missing_transmute_annotations
tosuspicious
#12239 - Added
integer_division_remainder_used
torestriction
#12451 - Added
duplicated_attributes
tosuspicious
#12378 - Added
manual_unwrap_or_default
tosuspicious
#12440 - Added
zero_repeat_side_effects
tosuspicious
#12449 - Added
const_is_empty
tosuspicious
#12310
Moves and Deprecations
- Moved
box_default
tostyle
(Fromperf
) #12601 - Moved
manual_clamp
tocomplexity
(Fromnursery
now warn-by-default) #12543 - Moved
readonly_write_lock
toperf
(Fromnursery
now warn-by-default) #12479
Enhancements
module_name_repetitions
: Added theallowed-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 themsrv
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 #12446
False Positive Fixes
cast_lossless
: No longer lints when casting tou128
#12496std_instead_of_core
No longer lints on modules that are only instd
#12447
ICE Fixes
needless_return
: No longer crashes on non-ascii characters #12493
Rust 1.78
Released 2024-05-02
View all 112 merged pull requests
New Lints
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
#12160
Enhancements
thread_local_initializer_can_be_made_const
: Now checks themsrv
configuration #12405disallowed_macros
: Code generated by derive macros can no longer allow this lint #12267wildcard_imports
: Add configurationallowed-wildcard-imports
to allow preconfigured wildcards #11979
ICE Fixes
ptr_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 #12508
Rust 1.77
Released 2024-03-18
View all 93 merged pull requests
New Lints
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
#11938
Enhancements
multiple_crate_versions
: Added theallowed-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 #11766
ICE Fixes
unit_arg
: No longer crashes when checking for const in nested bodies #11977indexing_slicing
: No longer crashes when the array index exceedsusize
#12266
Others
- Warnings about invalid fields inside
clippy.toml
files now include suggestions for existing fields #12180
Rust 1.76
Released 2024-02-08
View all 85 merged pull requests
New Lints
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
#11791
Moves and Deprecations
- Renamed
blocks_in_if_conditions
toblocks_in_conditions
#11853 - Moved
implied_bounds_in_impls
tocomplexity
(Now warn-by-default) #11867 - Moved
if_same_then_else
tostyle
(Now warn-by-default) #11809
Enhancements
missing_safety_doc
,unnecessary_safety_doc
,missing_panics_doc
,missing_errors_doc
: Added thecheck-private-items
configuration to enable lints on private items #11842
ICE Fixes
impl_trait_in_params
: No longer crashes when a function has generics but no function parameters #11804unused_enumerate_index
: No longer crashes on empty tuples #11756
Others
- Clippy now respects the
CARGO
environment value #11944
Rust 1.75
Released 2023-12-28
View all 69 merged pull requests
New Lints
unused_enumerate_index
#10404unnecessary_fallible_conversions
#11669waker_clone_wake
#11698struct_field_names
#11496into_iter_without_iter
#11587iter_without_into_iter
#11527manual_hash_one
#11556
Moves and Deprecations
- Moved
read_zero_byte_vec
tonursery
(Now allow-by-default) #11727 - Moved
missing_enforced_import_renames
tostyle
(Now warn-by-default) #11539 - Moved
needless_raw_string_hashes
topedantic
(Now allow-by-default) #11415 - Moved
needless_pass_by_ref_mut
tonursery
(Now allow-by-default) #11596
Enhancements
declare_interior_mutable_const
andborrow_interior_mutable_const
: Now check theignore-interior-mutability
config value #11678
Suggestion Fixes/Improvements
items_after_test_module
: The suggestion is now machine-applicable #11611
ICE Fixes
redundant_locals
: No longer crashes if variables are rebound above macros #11623implicit_hasher
: No longer lints inside macros, which could cause ICEs #11593
Documentation Improvements
cargo clippy --help
now uses colors for readability 🎉
Rust 1.74
Released 2023-11-16
View all 94 merged pull requests
New Lints
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
#11204
Moves and Deprecations
- Renamed
incorrect_clone_impl_on_copy_type
tonon_canonical_clone_impl
#11358 - Renamed
incorrect_partial_ord_impl_on_ord_type
tonon_canonical_partial_ord_impl
#11358 - Moved
non_canonical_clone_impl
tosuspicious
(Now warn-by-default) #11358 - Moved
non_canonical_partial_ord_impl
tosuspicious
(Now warn-by-default) #11358 - Moved
needless_pass_by_ref_mut
tonursery
(Now allow-by-default) #11596
Enhancements
undocumented_unsafe_blocks
: The config valuesaccept-comment-above-statement
andaccept-comment-above-attributes
are nowtrue
by default #11170explicit_iter_loop
: Addedenforce-iter-loop-reborrow
to disable reborrow linting by default #11418
ICE Fixes
enum_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 thanu64::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 #11070
Rust 1.73
Released 2023-10-05
View all 103 merged pull requests
New Lints
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
#10987
Moves and Deprecations
- Renamed
unwrap_or_else_default
tounwrap_or_default
#10120 - Moved
tuple_array_conversions
topedantic
(Now allow-by-default) #11146 - Moved
arc_with_non_send_sync
tosuspicious
(Now warn-by-default) #11104 - Moved
needless_raw_string_hashes
topedantic
(Now allow-by-default) #11415
Enhancements
unwrap_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 #11252
False Positive Fixes
panic_in_result_fn
: No longer triggers ontodo!
,unimplemented!
,unreachable!
#11123
Suggestion Fixes/Improvements
semicolon_if_nothing_returned
: The suggestion is now machine-applicable with rustfix #11083
ICE Fixes
filter_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 onNone.unwrap_or_default()
#11106- Fixed MIR-related ICE #11130
missing_fields_in_debug
: No longer crashes on non-ADT self types #11069
Rust 1.72
Released 2023-08-24
View all 131 merged pull requests
New Lints
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
#10810
Moves and Deprecations
- Moved
redundant_clone
tonursery
(Now allow-by-default) #10873
Enhancements
undocumented_unsafe_blocks
: Addedaccept-comment-above-attributes
configuration #10986undocumented_unsafe_blocks
: Addedaccept-comment-above-statement
configuration. #10886missing_panics_doc
: No longer lints ontodo!()
#10976module_inception
: Addedallow-private-module-inception
configuration. #10917- Errors and warnings generated while parsing
clippy.toml
now point to the location in the TOML file the error/warning occurred in. #10607
False Positive Fixes
excessive_precision
: No longer lints overflowing literals #10952
Suggestion Fixes/Improvements
option_map_unwrap_or
: The suggestion now considers the setmsrv
config value #11030
Documentation Improvements
- Clippy's lint list now stores filter parameters in the URL, to allow easy sharing #10834
Rust 1.71
Released 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
New Lints
non_minimal_cfg
#10763manual_next_back
#10769ref_patterns
#10736default_constructed_unit_structs
#10716manual_while_let_some
#10647needless_bool_assign
#10432items_after_test_module
#10578
Moves and Deprecations
- Rename
integer_arithmetic
toarithmetic_side_effects
#10674 - Moved
redundant_clone
tonursery
(Now allow-by-default) #10873
Enhancements
invalid_regex
: Now supports the new syntax introduced after regex v1.8.0 #10682semicolon_outside_block
: Addedsemicolon-outside-block-ignore-multiline
as a new config value. #10656semicolon_inside_block
: Addedsemicolon-inside-block-ignore-singleline
as a new config value. #10656unnecessary_box_returns
: Addedunnecessary-box-size
as a new config value to set the maximum size ofT
inBox<T>
to be linted. #10651
Documentation Improvements
cargo clippy --explain LINT
now shows possible configuration options for the explained lint #10751- New config values mentioned in this changelog will now be linked. #10889
- Several sections of Clippy's book have been reworked #10652 #10622
Rust 1.70
Released 2023-06-01
View all 91 merged pull requests
New Lints
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
#10534
Moves and Deprecations
- Moved
let_underscore_untyped
torestriction
#10442
Enhancements
extra_unused_type_parameters
: No longer lints on public items ifavoid-breaking-exported-api
is set #10536len_without_is_empty
: Now also detectsasync
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 #10533
False Positive Fixes
single_component_path_imports
: No longer lints if the import is used relative toself
#10566derivable_impls
: No longer suggests derivingDefault
on generics with implicit arguments #10399let_unit_value
: No longer lints if the expression contains anawait
#10439double_must_use
: Now ignoresasync
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 usingSelf
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 thefile!()
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 #10324
Suggestion Fixes/Improvements
extra_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 #10454
ICE Fixes
needless_borrow
: No longer panics on ambiguous projections #10403multiple_unsafe_ops_per_block
: Fix ICE when calling a function-like object in an unsafe block #10405
Others
clippy-driver
now searches parent directories forclippy.toml
files #10592- Fixed a deserialization error for the
array-size-threshold
config value #10423
Rust 1.69
Released 2023-04-20
View all 72 merged pull requests
New Lints
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
#10206
Moves and Deprecations
- Moved
uninlined_format_args
topedantic
(Now allow-by-default) #10265 - Moved
unchecked_duration_subtraction
topedantic
(Now allow-by-default) #10194
Enhancements
arithmetic_side_effects
: No longer lints if safe constant values are used. #10310needless_lifetimes
: Now works in local macros #10257unused_io_amount
: Now detects usages ofis_ok
andis_err
#10225missing_docs_in_private_items
: Added new configurationmissing-docs-in-crate-items
to lint on items visible within the current crate. For example,pub(crate)
items. #10303almost_swapped
: Now detects almost swaps usinglet
statements #10177wildcard_enum_match_arm
: Now lints missing private variants, for local enums #10250
False Positive Fixes
explicit_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 iflen
as a non-default signature #10255unusual_byte_groupings
: Relaxed the required restrictions for specific sizes to reduce false positives #10353manual_let_else
: No longer lintsif-else
blocks if they can divergent #10332expect_used
,unwrap_used
,dbg_macro
,print_stdout
,print_stderr
: No longer lint in test functions ifallow-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. #10311
Suggestion Fixes/Improvements
box_default
: The suggestion now includes the type for trait objects when needed #10382cast_possible_truncation
: Now suggests usingtry_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 #10346
ICE Fixes
needless_pass_by_value
: Fixed an ICE caused by how late bounds were handled #10328needless_borrow
: No longer panics on ambiguous projections #10403
Documentation Improvements
- All configurations are now documented in the Clippy Book #10199
Rust 1.68
Released 2023-03-09
View all 76 merged pull requests
New Lints
permissions_set_readonly_false
#10063almost_complete_range
#10043size_of_ref
#10098semicolon_outside_block
#9826semicolon_inside_block
#9826transmute_null_to_fn
#10099fn_null_check
#10099
Moves and Deprecations
- Moved
manual_clamp
tonursery
(Now allow-by-default) #10101 - Moved
mutex_atomic
torestriction
#10115 - Renamed
derive_hash_xor_eq
toderived_hash_with_manual_eq
#10184
Enhancements
collapsible_str_replace
: Now takes MSRV into consideration. The minimal version is 1.58 #10047unused_self
: No longer lints, if the method body contains atodo!()
call #10166derivable_impls
: Now suggests derivingDefault
for enums with default unit variants #10161arithmetic_side_effects
: Added two new config valuesarithmetic-side-effects-allowed-binary
andarithmetic-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 configsuppress-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 customHash
implementations #10184manual_is_ascii_check
: Now detects ranges with.contains()
calls #10053transmuting_null
: Now detectsconst
pointers to all types #10099needless_return
: Now detects more cases for returns of owned values #10110
False Positive Fixes
field_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 ofseek
is used. #10096manual_filter
: Now ignores if expressions where the else branch has side effects or doesn't returnNone
#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 inmatch
arms #10142arithmetic_side_effects
: No longer lints on corner cases with negative number literals #9867string_lit_as_bytes
: No longer lints in scrutinies ofmatch
statements #10012manual_assert
: No longer lints inelse if
statements #10013needless_return
: don't lint when usingdo yeet
#10109- All lints: No longer lint in enum discriminant values when the suggestion won't work in a const context #10008
single_element_loop
: No longer lints, if the loop contains abreak
orcontinue
#10162uninlined_format_args
: No longer suggests inlining arguments inassert!
anddebug_assert!
macros before 2021 edition #10055explicit_counter_loop
: No longer ignores counter changes aftercontinue
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 #10189
Suggestion Fixes/Improvements
zero_ptr
: Now suggestscore::
paths forno_std
crates #10023useless_conversion
: Now suggests removing calls tointo_iter()
on an expression implementingIterator
#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 withPath
#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 handlesmut
and reference annotations in the suggestion #10159redundant_static_lifetimes
: The suggestion no longer removesmut
from references #10006
ICE Fixes
new_ret_no_self
: Now avoids a stack overflow forimpl Trait
types #10086unnecessary_to_owned
: Now handles compiler generated notes better #10027
Others
SYSROOT
and--sysroot
can now be set at the same time #10149- Fix error when providing an
array-size-threshold
inclippy.toml
#10423
Rust 1.67
Released 2023-01-26
View all 104 merged pull requests
New Lints
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
#8437
Moves and Deprecations
- Moved
needless_collect
tonursery
(Now allow-by-default) #9705 - Moved
or_fun_call
tonursery
(Now allow-by-default) #9829 - Uplifted
let_underscore_lock
into rustc #9697 - Uplifted
let_underscore_drop
into rustc #9697 - Moved
bool_to_int_with_if
topedantic
(Now allow-by-default) #9830 - Move
index_refutable_slice
topedantic
(Now warn-by-default) #9975 - Moved
manual_clamp
tonursery
(Now allow-by-default) #10101
Enhancements
- The scope of
#![clippy::msrv]
is now tracked correctly #9924 #[clippy::msrv]
can now be used as an outer attribute #9860- Clippy will now avoid Cargo's cache, if
Cargo.toml
orclippy.toml
have changed #9707 uninlined_format_args
: Added a new configallow-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 needlessis_empty
andcontains
calls #8744blanket_clippy_restriction_lints
: Now lints, ifclippy::restriction
is enabled via the command line arguments #9755mutable_key_type
: Now has theignore-interior-mutability
configuration, to add types which should be ignored by the lint #9692uninlined_format_args
: Now works for multilineformat!
expressions #9945cognitive_complexity
: Now works for async functions #9828 #9836vec_box
: Now avoids an off-by-one error when using thevec-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 theallow-print-in-tests
config value #9797from_raw_with_void_ptr
: Now works forRc
,Arc
,alloc::rc::Weak
andalloc::sync::Weak
types. #9700needless_borrowed_reference
: Now works for struct and tuple patterns with wildcards #9855or_fun_call
: Now supportsmap_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 #9698
False Positive Fixes
new_ret_no_self
: No longer lints whenimpl 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 byDeref
#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 forif let Err()
with anelse
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 lintsif 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 #9871
Suggestion Fixes/Improvements
missing_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 suggestmatches!
replacements #9368string_extend_chars
: Suggestions now correctly work forstr
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 #9870
ICE Fixes
result_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 #10001
Rust 1.66
Released 2022-12-15
View all 116 merged pull requests
New Lints
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
#9617
Moves and Deprecations
positional_named_format_parameters
was uplifted to rustc under the new namenamed_arguments_used_positionally
#8518- Moved
implicit_saturating_sub
tostyle
(Now warn-by-default) #9584 - Moved
derive_partial_eq_without_eq
tonursery
(now allow-by-default) #9536
Enhancements
nonstandard_macro_braces
: Now includesmatches!()
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 #9476
False Positive Fixes
arithmetic_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 forunsafe_removed_from_name
#9593unnecessary_lazy_evaluations
: No longer suggest switching to early evaluation when type has customDrop
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 takeslet ... else
statements into consideration. #9496default_numeric_fallback
: Now ignores constants #9636uninit_vec
: No longer lintsVec::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 fordefault
methods #9546
Suggestion Fixes/Improvements
derivable_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 forformat!
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 markedMaybeIncorrect
to avoid semantic changes #9634assertions_on_result_states
: The suggestion has been corrected, for cases where theassert!
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 forimpl FnMut
arguments #9556
ICE Fixes
unnecessary_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 unsizeddyn Fn
arguments #9531*_interior_mutable_const
lints: no longer ICE on const unions containing!Freeze
types #9539
Others
- Released
rustc_tools_util
for version information onCrates.io
. (Further adjustments will not be published as part of this changelog)
Rust 1.65
Released 2022-11-03
View all 86 merged pull requests
Important Changes
- Clippy now has an
--explain <LINT>
command to show the lint description in the console #8952
New Lints
unused_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
#9264
Moves and Deprecations
- Moved
significant_drop_in_scrutinee
tonursery
(now allow-by-default) #9302 - Rename
logic_bug
tooverly_complex_bool_expr
#9306 - Rename
arithmetic
toarithmetic_side_effects
#9443 - Moved
only_used_in_recursion
to complexity (now warn-by-default) #8804 - Moved
assertions_on_result_states
to restriction (now allow-by-default) #9273 - Renamed
blacklisted_name
todisallowed_names
#8974
Enhancements
option_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 #9318
False Positive Fixes
unit_arg
default_trait_access
missing_docs_in_private_items
: No longer trigger in code generated from proc-macros #8694unwrap_used
: Now lints uses ofunwrap_err
#9338expect_used
: Now lints uses ofexpect_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 isSized
, ondyn 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 lintif 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 #9273
Suggestion Fixes/Improvements
unwrap_or_else_default
: Now suggestsunwrap_or_default()
for empty strings #9421if_then_some_else_none
: Now also suggestsbool::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 suggestsmap_or(..)
instead ofmap(..).unwrap_or
#9341- Deprecated configuration values can now be updated automatically #9252
or_fun_call
: Now suggestEntry::or_default
forEntry::or_insert(Default::default())
#9342unwrap_used
: Only suggestsexpect
ifexpect_used
is allowed #9223
ICE Fixes
- Fix ICE in
useless_format
for literals #9406 - Fix infinite loop in
vec_init_then_push
#9441 - Fix ICE when reading literals with weird proc-macro spans #9303
Rust 1.64
Released 2022-09-22
View all 110 merged pull requests
New Lints
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
#8355
Moves and Deprecations
- Moved
format_push_string
torestriction
(now allow-by-default) #9161
Enhancements
significant_drop_in_scrutinee
: Now gives more context in the lint message #8981single_match
,single_match_else
: Now catches moreOption
cases #8985unused_async
: Now works for async methods #9025manual_filter_map
,manual_find_map
: Now lint more expressions #8958question_mark
: Now works for simpleif 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 withvec.capacity()
#8953unused_self
: Now respects theavoid-breaking-exported-api
config option #9199box_collection
: Now supports all std collections #9170
False Positive Fixes
significant_drop_in_scrutinee
: Now ignores calls toIntoIterator::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 thethread_local!
macro #9015if_same_then_else
: Now ignores branches withtodo!
andunimplemented!
#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 withtodo!
#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 onfn 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 #9246
Suggestion Fixes/Improvements
type_repetition_in_bounds
: The suggestion now works with maybe bounds #9132transmute_ptr_to_ref
: Now suggestspointer::cast
when possible #8939useless_format
: Now suggests the correct variable name #9237or_fun_call
: The lint emission will now only span over theunwrap_or
call #9144neg_multiply
: Now suggests adding parentheses around suggestion if needed #9026unnecessary_lazy_evaluations
: Now suggest forbool::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 inFnOnce
closures #9134
ICE Fixes
- Fix ICEs related to
#![feature(generic_const_exprs)]
usage #9241 - Fix ICEs related to reference lints #9093
question_mark
: Fix ICE on zero field tuple structs #9244
Documentation Improvements
needless_option_take
: Now includes a "What it does" and "Why is this bad?" section. #9022
Others
- Using
--cap-lints=allow
and only--force-warn
ing some will now work with Clippy's driver #9036 - Clippy now tries to read the
rust-version
fromCargo.toml
to identify the minimum supported rust version #8774
Rust 1.63
Released 2022-08-11
View all 91 merged pull requests
New Lints
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
#8934
Moves and Deprecations
- Rename
eval_order_dependence
tomixed_read_write_in_expression
, move tonursery
#8621
Enhancements
undocumented_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 theallow-expect-in-tests
option #8802unwrap_used
: Now can be disabled in tests with theallow-unwrap-in-tests
option #8802disallowed_methods
: Now also lints indirect usages #8852get_last_with_len
: Now also lintsVecDeque
and any deref to slice #8862manual_range_contains
: Now also lints on chains of&&
and||
#8884rc_clone_in_vec_init
: Now also lints onWeak
#8885dbg_macro
: Introduceallow-dbg-in-tests
config option #8897use_self
: Now also lints onTupleStruct
andStruct
patterns #8899manual_find_map
andmanual_filter_map
: Now also lints on more complex method chains insidemap
#8930needless_return
: Now also lints on macro expressions in return statements #8932doc_markdown
: Users can now indicate, that thedoc-valid-idents
config should extend the default and not replace it #8944disallowed_names
: Users can now indicate, that thedisallowed-names
config should extend the default and not replace it #8944never_loop
: Now checks forcontinue
in struct expression #9002
False Positive Fixes
useless_transmute
: No longer lints on types with erased regions #8564vec_init_then_push
: No longer lints when further extended #8699cmp_owned
: No longer lints onFrom::from
forCopy
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?
andawait
desugared expressions #8902checked_conversions
: No longer lints inconst
contexts #8907iter_overeager_cloned
: No longer lints on.cloned().flatten()
whenT::Item
doesn't implementIntoIterator
#8960
Suggestion Fixes/Improvements
vec_init_then_push
: Suggest to removemut
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 onusize
/isize
->f64
#8778rc_clone_in_vec_init
: Add suggestion #8814- The "unknown field" error messages for config files now wraps the field names #8823
cast_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 ofiter()
,iter_mut()
orinto_iter()
#8941
ICE Fixes
- Fix ICE in
let_unit_value
when calling astatic
/const
callable type #8835 - Fix ICEs on callable
static
/const
s #8896 needless_late_init
#8912- Fix ICE in shadow lints #8913
Documentation Improvements
- Clippy has a Book now! #7359
- Add a copy lint name-button to Clippy's lint list #8839
- Display past names of renamed lints on Clippy's lint list #8843
- Add the ability to show the lint output in the lint list #8947
Rust 1.62
Released 2022-06-30
View all 90 merged pull requests
New Lints
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
#8630
Moves and Deprecations
- Move
only_used_in_recursion
tonursery
(now allow-by-default) #8783 - Move
stable_sort_primitive
topedantic
(now allow-by-default) #8716
Enhancements
- Remove overlap between
manual_split_once
andneedless_splitn
#8631 map_identity
: Now checks for needlessmap_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 ofsplitn
#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 #8619
False Positive Fixes
rest_pat_in_fully_bound_structs
: Now ignores structs marked with#[non_exhaustive]
#8690needless_late_init
: No longer lintsif 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 foras_deref_mut
onOption
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 fromcfg!
macros #8614indexing_slicing
: Fix false positives with constant indices in #8588iter_with_drain
: Now ignores iterator references #8668useless_attribute
: Now allowsredundant_pub_crate
onuse
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 foris_*
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 inconst
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 #8563
Suggestion Fixes/Improvements
manual_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 suggestfrom_utf8_unchecked
inconst
context #8612map_clone
: Improve message and suggestion based on the msrv #8688needless_late_init
: Now shows thelet
statement where it was first initialized #8779
ICE Fixes
only_used_in_recursion
#8691cast_slice_different_sizes
#8720iter_overeager_cloned
#8602undocumented_unsafe_blocks
#8686
Rust 1.61
Released 2022-05-19
View all 60 merged pull requests
New Lints
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
#8445
Moves and Deprecations
- Moved
transmute_undefined_repr
tonursery
(now allow-by-default) #8432 - Moved
try_err
torestriction
#8544 - Move
iter_with_drain
tonursery
#8541 - Renamed
to_string_in_display
torecursive_format_impl
#8188
Enhancements
dbg_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 forparking_lot::{Mutex, RwLock}
#8419recursive_format_impl
: Now checks for format calls onself
#8188
False Positive Fixes
new_without_default
: No longer lints fornew()
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 lintmatch
expressions withcfg
ed arms #8443single_component_path_imports
: No longer lint on macros #8537ptr_arg
: Allow&mut
arguments forCow<_>
#8552needless_borrow
: No longer lints for method calls #8441match_same_arms
: Now ensures that interposing arm patterns don't overlap #8232default_trait_access
: Now allowsDefault::default
in update expressions #8433
Suggestion Fixes/Improvements
redundant_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 suggestsReverse
including the path #8462search_is_some
: More suggestions are nowMachineApplicable
#8536
Documentation Improvements
new_without_default
: Documentpub
requirement for the struct and fields #8429
Rust 1.60
Released 2022-04-07
View all 73 merged pull requests
New Lints
single_char_lifetime_names
#8236iter_overeager_cloned
#8203transmute_undefined_repr
#8398default_union_representation
#8289manual_bits
#8213borrow_as_ptr
#8210
Moves and Deprecations
- Moved
disallowed_methods
anddisallowed_types
tostyle
(now warn-by-default) #8261 - Rename
ref_in_deref
toneedless_borrow
#8217 - Moved
mutex_atomic
tonursery
(now allow-by-default) #8260
Enhancements
ptr_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 withSelf
bounds #8252unwrap_used
: Now works for.get(i).unwrap()
and.get_mut(i).unwrap()
#8372map_clone
: The suggestion takesmsrv
into account #8280manual_bits
andborrow_as_ptr
: Now track theclippy::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 wrongself
references in more cases #8208single_match
: Now works formatch
statements with tuples #8322
False Positive Fixes
erasing_op
: No longer triggers if the output type changes #8204if_same_then_else
: No longer triggers forif let
statements #8297manual_memcpy
: No longer lints onVecDeque
#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 explicitself
types #8278op_ref
: No longer lints inBinOp
impl if that can cause recursion #8298enum_variant_names
: No longer triggers for empty variant names #8329redundant_closure
: No longer lints forArc<T>
orRc<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 #8295
Suggestion Fixes/Improvements
needless_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 forwrite!
s with format arguments #8365manual_memcpy
: Suggestscopy_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 suggestsiter()
on references #8382
ICE Fixes
Documentation Improvements
map_flatten
: Add documentation for theOption
type #8354- Document that Clippy's driver might use a different code generation than rustc #8037
- Clippy's lint list will now automatically focus the search box #8343
Others
- Clippy now warns if we find multiple Clippy config files exist #8326
Rust 1.59
Released 2022-02-24
View all 94 merged pull requests
New Lints
index_refutable_slice
#7643needless_splitn
#7896unnecessary_to_owned
#7978needless_late_init
#7995octal_escapes
#8007return_self_not_must_use
#8071init_numbered_fields
#8170
Moves and Deprecations
- Move
if_then_panic
topedantic
and rename tomanual_assert
(now allow-by-default) #7810 - Rename
disallow_type
todisallowed_types
anddisallowed_method
todisallowed_methods
#7984 - Move
map_flatten
tocomplexity
(now warn-by-default) #8054
Enhancements
match_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 forbool
to integer casts #7948let_underscore_lock
: Also emit lints for theparking_lot
crate #7957needless_borrow
#7977- Lint when a borrow is auto-dereffed more than once
- Lint in the trailing expression of a block for a match arm
strlen_on_c_strings
8001- Lint when used without a fully-qualified path
- Suggest removing the surrounding unsafe block when possible
non_ascii_literal
: Now also lints onchar
s, not juststring
s #8034single_char_pattern
: Now also lints onsplit_inclusive
,split_once
,rsplit_once
,replace
, andreplacen
#8077unwrap_or_else_default
: Now also lints onstd
constructors likeVec::new
,HashSet::new
, andHashMap::new
#8163shadow_reuse
: Now also lints on shadowedif let
bindings, instead ofshadow_unrelated
#8165
False Positive Fixes
or_fun_call
,unnecessary_lazy_evaluations
: Improve heuristics, so that cheap functions (e.g. calling.len()
on aVec
) won't get linted anymore #7639manual_split_once
: No longer suggests code changing the original behavior #7896- Don't show
no_effect
orunnecessary_operation
warning for unit struct implementingFnOnce
#7898 semicolon_if_nothing_returned
: Fixed a bug, where the lint wrongly triggered onlet-else
statements #7955if_then_some_else_none
: No longer lints if there is an early return #7980needless_collect
: No longer suggests removal ofcollect
when removal would create code requiring mutably borrowing a value multiple times #7982shadow_same
: Fix false positive forasync
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 #8183
Suggestion Fixes/Improvements
search_is_some
: Fix suggestion forany()
not taking item by reference #7463almost_swapped
: Now detects if there is ano_std
orno_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
: Suggestmap
overand_then
when possible #7971option_if_let_else
: No longer expands macros in the suggestion #7974iter_cloned_collect
: Suggestcopied
overcloned
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
: Suggesta != b
over!(a == b)
#8117iter_skip_next
: Suggest to add amut
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 forto_radians
andto_degrees
#8187
ICE Fixes
Documentation Improvements
print_stdout
,print_stderr
,dbg_macro
: Document how the lint level can be changed crate-wide #8040- Added a note to the
README
that config changes don't apply to already compiled code #8175
Others
- Clippy's lint list now displays the version a lint was added. 🎉 #7813
- New and improved issue templates #8032
- Dev: Add
cargo dev lint
command, to run your modified Clippy version on a file #7917
Rust 1.58
Released 2022-01-13
View all 68 merged pull requests
Rust 1.58.1
- Move
non_send_fields_in_send_ty
tonursery
(now allow-by-default) #8075 useless_format
: Handle implicit named arguments #8295
New lints
transmute_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
#7878
Moves or deprecations of lints
- Move
non_send_fields_in_send_ty
tosuspicious
#7874 - Move
non_ascii_literal
torestriction
#7907
Changes that expand what code existing lints cover
question_mark
now coversResult
#7840- Make
useless_format
recognize bareformat!("")
#7801 - Lint on underscored variables with no side effects in
no_effect
#7775 - Expand
match_ref_pats
to check for multiple reference patterns #7800
False positive fixes
- Fix false positive of
implicit_saturating_sub
withelse
clause #7832 - Fix
question_mark
when there is call in conditional predicate #7860 mut_mut
no longer lints when type is defined in external macros #7795- Avoid
eq_op
in test functions #7811 cast_possible_truncation
no longer lints when cast is coming fromsignum
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 #7895- Avoid linting
cast_possible_truncation
on bit-reducing operations #7819 - Avoid linting
field_reassign_with_default
whenDrop
andCopy
are involved #7794 unnecessary_sort_by
now checks if argument implementsOrd
trait #7824- Fix false positive in
match_overlapping_arm
#7847 - Prevent
needless_lifetimes
false positive inasync
function definition #7901
Suggestion fixes/improvements
- Keep an initial
::
whendoc_markdown
suggests to use ticks #7916 - Add a machine applicable suggestion for the
doc_markdown
missing backticks lint #7904 equatable_if_let
no longer expands macros in the suggestion #7788- Make
shadow_reuse
suggestion less verbose #7782
ICE fixes
- Fix ICE in
enum_variant_names
#7873 - Fix ICE in
undocumented_unsafe_blocks
#7891
Documentation improvements
- Fixed naive doc formatting for
#[must_use]
lints (must_use_unit
,double_must_use
,must_use_candidate
,let_underscore_must_use
) #7827 - Fix typo in example for
match_result_ok
#7815
Others
- Allow giving reasons for
disallowed_types
#7791 - Fix
manual_assert
andmatch_wild_err_arm
for#![no_std]
and Rust 2021. #7851 - Fix regression in
semicolon_if_nothing_returned
on macros containing while loops #7789 - Added a new configuration
literal-suffix-style
to enforce a certain style writingunseparated_literal_suffix
#7726
Rust 1.57
Released 2021-12-02
View all 148 merged pull requests
New Lints
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
#7762
Moves and Deprecations
- Move
shadow_unrelated
torestriction
#7338 - Move
option_if_let_else
tonursery
#7568 - Move
branches_sharing_code
tonursery
#7595 - Rename
if_let_some_result
tomatch_result_ok
which now also handleswhile let
cases #7608 - Move
many_single_char_names
topedantic
#7671 - Move
float_cmp
topedantic
#7692 - Rename
box_vec
tobox_collection
and lint on more general cases #7693 - Uplift
invalid_atomic_ordering
to rustc rust-lang/rust#84039
Enhancements
- Rewrite the
shadow*
lints, so that they find a lot more shadows and are not limited to certain patterns #7338 - The
avoid-breaking-exported-api
configuration now also works forbox_collection
,redundant_allocation
,rc_buffer
,vec_box
,option_option
,linkedlist
,rc_mutex
#7560 unnecessary_unwrap
: Now also checks forexpect
s #7584disallowed_methods
: Allow adding a reason that will be displayed with the lint message #7621approx_constant
: Now checks the MSRV forLOG10_2
andLOG2_10
#7629approx_constant
: AddTAU
#7642needless_borrow
: Now also lints on needless mutable borrows #7657missing_safety_doc
: Now also lints on unsafe traits #7734
False Positive Fixes
manual_map
: No longer lints when the option is borrowed in the match and also consumed in the arm #7531filter_next
: No longer lints iffilter
method is not theIterator::filter
method #7562manual_flatten
: No longer lints if expression is used afterif let
#7566option_if_let_else
: Multiple fixes #7573break
andcontinue
statements local to the would-be closure are allowed- Don't lint in const contexts
- Don't lint when yield expressions are used
- Don't lint when the captures made by the would-be closure conflict with the other branch
- Don't lint when a field of a local is used when the type could be potentially moved from
- In some cases, don't lint when scrutinee expression conflicts with the captures of the would-be closure
redundant_allocation
: No longer lints onBox<Box<dyn T>>
which replaces wide pointers with thin pointers #7592bool_assert_comparison
: No longer lints on types that do not implement theNot
trait withOutput = bool
#7605mut_range_bound
: No longer lints on range bound mutations, that are immediately followed by abreak;
#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 #7772
Suggestion Fixes/Improvements
unnecessary_operation
: Recommend using anassert!
instead of using a function call in an indexing operation #7453manual_split_once
: Produce semantically equivalent suggestion whenrsplitn
is used #7663while_let_on_iterator
: Produce correct suggestion when using&mut
#7690manual_assert
: No better handles complex conditions #7741- Correctly handle signs in exponents in numeric literals lints #7747
suspicious_map
: Now also suggests to useinspect
as an alternative #7770- Drop exponent from suggestion if it is 0 in numeric literals lints #7774
ICE Fixes
Others
Rust 1.56
Released 2021-10-21
View all 38 merged pull requests
New Lints
Enhancements
needless_continue
: Now also lints inloop { 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 theResult
type #7522no_effect
: Now also lints on inclusive ranges #7556
False Positive Fixes
nonstandard_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 aboutiter
anditem
being too similar #7546
Suggestion Fixes/Improvements
similar_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 aDefault
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 handlesSelf
type #7535never_loop
: Now suggests usingif let
instead of afor
loop when applicable #7541
Documentation Improvements
- Clippy now uses a lint to generate its lint documentation. Lints all the way down. #7502
- Reworked Clippy's website:
#7172
#7279
- Added applicability information about lints
- Added a link to jump into the implementation
- Improved loading times
- Adapted some styling
cargo clippy --help
now also explains the--fix
and--no-deps
flag #7492unnested_or_patterns
: Removedor_patterns
feature gate in the code example #7507
Rust 1.55
Released 2021-09-09
View all 83 merged pull requests
Important Changes
- Stabilized
cargo clippy --fix
🎉 #7405
New Lints
rc_mutex
#7316nonstandard_macro_braces
#7299strlen_on_c_strings
#7243self_named_constructors
#7403disallowed_script_idents
#7400disallowed_types
#7315missing_enforced_import_renames
#7300extend_with_drain
#7270
Moves and Deprecations
- Moved
from_iter_instead_of_collect
topedantic
#7375 - Added
suspicious
as a new lint group for code that is most likely wrong or useless #7350- Moved
blanket_clippy_restriction_lints
tosuspicious
- Moved
empty_loop
tosuspicious
- Moved
eval_order_dependence
tosuspicious
- Moved
float_equality_without_abs
tosuspicious
- Moved
for_loops_over_fallibles
tosuspicious
- Moved
misrefactored_assign_op
tosuspicious
- Moved
mut_range_bound
tosuspicious
- Moved
mutable_key_type
tosuspicious
- Moved
suspicious_arithmetic_impl
tosuspicious
- Moved
suspicious_assignment_formatting
tosuspicious
- Moved
suspicious_else_formatting
tosuspicious
- Moved
suspicious_map
tosuspicious
- Moved
suspicious_op_assign_impl
tosuspicious
- Moved
suspicious_unary_op_formatting
tosuspicious
- Moved
Enhancements
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 theArc<>
type #7308disallowed_names
: Now allows disallowed names in test code #7379redundant_closure
: Suggests&mut
forFnMut
#7437disallowed_methods
,disallowed_types
: The configuration valuesdisallowed-method
anddisallowed-type
no longer require fully qualified paths #7345zst_offset
: Fixed lint invocation after it was accidentally suppressed #7396
False Positive Fixes
default_numeric_fallback
: No longer lints on float literals as function arguments #7446use_self
: No longer lints on type parameters #7288unimplemented
: Now ignores theassert
anddebug_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 #7319
Suggestion Fixes/Improvements
needless_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 #7326
ICE Fixes
Rust 1.54
Released 2021-07-29
View all 74 merged pull requests
New Lints
ref_binding_to_reference
#7105needless_bitwise_bool
#7133unused_async
#7225manual_str_repeat
#7265suspicious_splitn
#7292
Moves and Deprecations
- Deprecate
pub_enum_variant_names
andwrong_pub_self_convention
in favor of the newavoid-breaking-exported-api
config option (see Enhancements) #7187 - Move
inconsistent_struct_constructor
topedantic
#7193 - Move
needless_borrow
tostyle
(now warn-by-default) #7254 - Move
suspicious_operation_groupings
tonursery
#7266 - Move
semicolon_if_nothing_returned
topedantic
#7268
Enhancements
while_let_on_iterator
: Now also lints in nested loops #6966single_char_pattern
: Now also lints onstrip_prefix
andstrip_suffix
#7156needless_collect
: Now also lints on assignments with type annotations #7163if_then_some_else_none
: Now works with the MSRV config #7177- Add
avoid-breaking-exported-api
config option for the lintsenum_variant_names
,large_types_passed_by_value
,trivially_copy_pass_by_ref
,unnecessary_wraps
,upper_case_acronyms
, andwrong_self_convention
. We recommend to set this configuration option tofalse
before a major release (1.0/2.0/...) to clean up the API #7187 needless_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 withallow
#7282
False Positive Fixes
implicit_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 aconst
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 thefilter_map
changes the type #7175wrong_self_convention
: No longer lints in trait implementations of non-Copy
types #7182suboptimal_flops
: No longer lints onpowi(2)
#7201wrong_self_convention
: No longer lints if there is no implicitself
#7215option_if_let_else
: No longer lints onelse 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 onwparam
/lparam
#7255redundant_closure
: No longer lints on using thevec![]
macro in a closure #7263
Suggestion Fixes/Improvements
implicit_return
#6951- Fix suggestion for async functions
- Improve suggestion with macros
- Suggest to change
break
toreturn
when appropriate
while_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 #7294
ICE Fixes
- Fix ICE when running Clippy on
libstd
#7140 implicit_return
#7242
Rust 1.53
Released 2021-06-17
View all 126 merged pull requests
New Lints
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
#7101
Moves and Deprecations
- Deprecate
filter_map
lint #7059 - Move
transmute_ptr_to_ptr
topedantic
#7102
Enhancements
mem_replace_with_default
: Also lint on common std constructors #6820wrong_self_convention
: Also lint onto_*_mut
methods #6828wildcard_enum_match_arm
,match_wildcard_for_single_variants
: #6863- Attempt to find a common path prefix in suggestion
- Don't lint on
Option
andResult
- Consider
Self
prefix
explicit_deref_methods
: Also lint on chainedderef
calls #6865or_fun_call
: Also lint onunsafe
blocks #6928vec_box
,linkedlist
,option_option
: Also lint inconst
andstatic
items #6938search_is_some
: Also check foris_none
#6942string_lit_as_bytes
: Also lint oninto_bytes
#6959len_without_is_empty
: Also lint if function signatures oflen
andis_empty
don't match #6980redundant_pattern_matching
: Also lint if the pattern is a&
pattern #6991clone_on_copy
: Also lint on chained method calls takingself
by value #7000missing_panics_doc
: Also lint onassert_eq!
andassert_ne!
#7029needless_return
: Also lint inasync
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 #7138
False Positive Fixes
upper_case_acronyms
: No longer lints on public items #6805suspicious_map
: No longer lints when side effects may occur inside themap
call #6831manual_map
,manual_unwrap_or
: No longer lints inconst
functions #6917wrong_self_convention
: Now respectsCopy
types #6924needless_question_mark
: No longer lints if the?
and theSome(..)
come from different macro contexts #6935map_entry
: Better detect if the entry API can be used #6937or_fun_call
: No longer lints on somelen
function calls #6950new_ret_no_self
: No longer lints whenSelf
is returned with different generic arguments #6952upper_case_acronyms
: No longer lints on public items #6981explicit_into_iter_loop
: Only lint wheninto_iter
is an implementation ofIntoIterator
#6982expl_impl_clone_on_copy
: Take generic constraints into account before suggesting to usederive
instead #6993missing_panics_doc
: No longer lints when only debug-assertions are used #6996clone_on_copy
: Only lint when using theClone
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 theVec
is used in the loop body #7018cargo_common_metadata
: Remove author requirement #7026panic_in_result_fn
: No longer lints ondebug_assert
family #7060panic
: No longer wrongfully lints ondebug_assert
with message #7063wrong_self_convention
: No longer lints in trait implementations where noself
is involved #7064missing_const_for_fn
: No longer lints when unstableconst
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 #7120
Suggestion Fixes/Improvements
redundant_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 complexif let ... else
chains #6856inconsistent_struct_constructor
: Make lint description and message clearer #6892map_entry
: Now suggestsor_insert
,insert_with
ormatch _.entry(_)
as appropriate #6937manual_flatten
: Suggest to insertcopied
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 #7004- Fix needless parenthesis output in multiple lint suggestions #7013
needless_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 implementPartialEq
#7093from_over_into
: Mention type in help message #7099manual_unwrap_or
: Fix invalid code suggestion due to a macro call #7136
ICE Fixes
macro_use_imports
#7022missing_panics_doc
#7034tabs_in_doc_comments
#7039missing_const_for_fn
#7128
Others
- Clippy's lint list now supports themes #7030
- Lints that were uplifted to
rustc
now mention the newrustc
name in the deprecation warning #7056
Rust 1.52
Released 2021-05-06
View all 102 merged pull requests
New Lints
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
#6573
Moves and Deprecations
- Moved
upper_case_acronyms
topedantic
#6775 - Moved
manual_map
tonursery
#6796 - Moved
unnecessary_wraps
topedantic
#6765 - Moved
trivial_regex
tonursery
#6696 - Moved
naive_bytecount
topedantic
#6825 - Moved
upper_case_acronyms
tostyle
#6788 - Moved
manual_map
tostyle
#6801
Enhancements
disallowed_methods
: Now supports functions in addition to methods #6674upper_case_acronyms
: Added a new configurationupper-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, likeOption<()>
#6665- Improved value usage detection in closures #6698
False Positive Fixes
use_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
: AddOpenDNS
to the default configuration as an allowed identifier #6783missing_panics_doc
: No longer lints onunreachable!
#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 likereturn
,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 thelen
method as well as the type definition. #6853let_underscore_drop
: Only lints on types which implementDrop
#6682unit_arg
: No longer lints on unit arguments when they come from a path expression. #6601cargo_common_metadata
: No longer lints ifpublish = false
is defined in the manifest #6650
Suggestion Fixes/Improvements
collapsible_match
: Fixed lint message capitalization #6766or_fun_call
: Improved suggestions foror_insert(vec![])
#6790manual_map
: No longer expands macros in the suggestions #6801- Aligned Clippy's lint messages with the rustc dev guide #6787
ICE Fixes
Documentation Improvements
useless_format
: Improved the documentation example #6854- Clippy's
README.md
: Includes a new subsection on running Clippy as a rustc wrapper #6782
Others
- Running
cargo clippy
aftercargo check
now works as expected (cargo clippy
andcargo check
no longer shares the same build cache) #6687 - Cargo now re-runs Clippy if arguments after
--
provided tocargo clippy
are changed. #6834 - Extracted Clippy's
utils
module into the newclippy_utils
crate #6756 - Clippy lintcheck tool improvements #6800 #6735 #6764 #6708 #6780 #6686
Rust 1.51
Released 2021-03-25
View all 78 merged pull requests
New Lints
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 fromcollapsible_if
) #6544inspect_for_each
#6577manual_filter_map
#6591exhaustive_enums
#6617exhaustive_structs
#6617
Moves and Deprecations
- Replace
find_map
withmanual_find_map
#6591 unknown_clippy_lints
Now integrated in theunknown_lints
rustc lint #6653
Enhancements
ptr_arg
Now also suggests to use&Path
instead of&PathBuf
#6506cast_ptr_alignment
Also lint when thepointer::cast
method is used #6557collapsible_match
Now also deals with&
and*
operators in thematch
scrutinee #6619
False Positive Fixes
similar_names
Ignore underscore prefixed names #6403print_literal
andwrite_literal
No longer lint numeric literals #6408large_enum_variant
No longer lints in external macros #6485empty_enum
Only lint ifnever_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
AddWebGL
to the default configuration as an allowed identifier #6605
Suggestion Fixes/Improvements
field_reassign_with_default
Don't expand macro in lint suggestion #6531match_like_matches_macro
Strip references in suggestion #6532single_match
Suggestif
overif let
when possible #6574ref_in_deref
Use parentheses correctly in suggestion #6609stable_sort_primitive
Clarify error message #6611
ICE Fixes
Documentation Improvements
- Improve search performance on the Clippy website and make it possible to directly search for lints on the GitHub issue tracker #6483
- Clean up
README.md
by removing outdated paragraph #6488 await_holding_refcell_ref
andawait_holding_lock
#6585as_conversions
#6608
Others
- Clippy now has a Roadmap for 2021. If you like to get involved in a bigger project, take a look at the Roadmap project page. All issues listed there are actively mentored #6462
- The Clippy version number now corresponds to the Rust version number #6526
- Fix oversight which caused Clippy to lint deps in some environments, where
CLIPPY_TESTS=true
was set somewhere #6575 - Add
cargo dev-lintcheck
tool to the Clippy Dev Tool #6469
Rust 1.50
Released 2021-02-11
View all 119 merged pull requests
New Lints
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
#6134
Moves and Deprecations
- Previously deprecated
str_to_string
andstring_to_string
have been un-deprecated asrestriction
lints #6333 - Deprecate
panic_params
lint. This is now available in rustc asnon_fmt_panics
#6351 - Move
map_err_ignore
torestriction
#6416 - Move
await_holding_refcell_ref
topedantic
#6354 - Move
await_holding_lock
topedantic
#6354
Enhancements
- Add the
unreadable-literal-lint-fractions
configuration to disable theunreadable_literal
lint for fractions #6421 clone_on_copy
: Now shows the type in the lint message #6443redundant_pattern_matching
: Now also lints onstd::task::Poll
#6339redundant_pattern_matching
: Additionally also lints onstd::net::IpAddr
#6377search_is_some
: Now suggestscontains
instead offind(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 indexingHashMap
orBTreeMap
#6267wrong_self_convention
: Now also lints in trait definitions #6316needless_borrow
: Print the type in the lint message #6449
False Positive Fixes
manual_range_contains
: No longer lints inconst 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 ignoresnon_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
andborrow_interior_mutable_const
: Both now ignore enums with frozen variants #6110field_reassign_with_default
No longer lint for private fields #6537
Suggestion Fixes/Improvements
vec_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 #6362
ICE Fixes
- Fix a crash in
from_iter_instead_of_collect
#6304 - Fix a silent crash when parsing doc comments in
needless_doctest_main
#6458
Documentation Improvements
- The lint website search has been improved (#6477):
- Searching for lints with dashes and spaces is possible now. For example
missing-errors-doc
andmissing errors doc
are now valid aliases for lint names - Improved fuzzy search in lint descriptions
- Searching for lints with dashes and spaces is possible now. For example
- Various README improvements #6287
- Add known problems to
comparison_chain
documentation #6390 - Fix example used in
cargo_common_metadata
#6293 - Improve
map_clone
documentation #6340
Others
- You can now tell Clippy about the MSRV your project supports. Please refer to the specific README section to learn more about MSRV support here #6201
- Add
--no-deps
option to avoid running on path dependencies in workspaces #6188
Rust 1.49
Released 2020-12-31
View all 107 merged pull requests
New Lints
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
#6233
Moves and Deprecations
- Rename
single_char_push_str
tosingle_char_add_str
#6037 - Rename
zero_width_space
toinvisible_characters
#6105 - Deprecate
drop_bounds
(uplifted) #6111 - Move
string_lit_as_bytes
tonursery
#6117 - Move
rc_buffer
torestriction
#6128
Enhancements
manual_memcpy
: Also lint when there are loop counters (and produce a reliable suggestion) #5727single_char_add_str
: Also lint onString::insert_str
#6037invisible_characters
: Also lint the characters\u{AD}
and\u{2060}
#6105eq_op
: Also lint on theassert_*!
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 lintResult::unwrap_or
#6190match_like_matches_macro
: Also lint whenmatch
has more than two arms #6216integer_arithmetic
: Better handle/
an%
operators #6229
False Positive Fixes
needless_lifetimes
: Bail out if the function has awhere
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 ofconst 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 withinbytes::Regex
#6132boxed_local
: No longer lints onextern fn
arguments #6133needless_lifetimes
: Fix regression, where lifetime is used inwhere
clause #6198
Suggestion Fixes/Improvements
unnecessary_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 #6247
Documentation Improvements
- Some doc improvements:
doc_markdown
: Document problematic link text style #6107
Rust 1.48
Released 2020-11-19
View all 99 merged pull requests
New lints
self_assignment
#5894unnecessary_lazy_evaluations
#5720manual_strip
#6038map_err_ignore
#5998rc_buffer
#6044to_string_in_display
#5831single_char_push_str
#5881
Moves and Deprecations
- Downgrade
verbose_bit_mask
to pedantic #6036
Enhancements
- Extend
precedence
to handle chains of methods combined with unary negation #5928 useless_vec
: add a configuration value for the maximum allowed size on the stack #5907suspicious_arithmetic_impl
: extend to implementations ofBitAnd
,BitOr
,BitXor
,Rem
,Shl
, andShr
#5884invalid_atomic_ordering
: detect misuse ofcompare_exchange
,compare_exchange_weak
, andfetch_update
#6025- Avoid
redundant_pattern_matching
triggering in macros #6069 option_if_let_else
: distinguish pure from impureelse
expressions #5937needless_doctest_main
: parse doctests instead of using textual search #5912wildcard_imports
: allowprelude
to appear in any segment of an import #5929- Re-enable
len_zero
for ranges now thatrange_is_empty
is stable #5961 option_as_ref_deref
: catch fully-qualified calls toDeref::deref
andDerefMut::deref_mut
#5933
False Positive Fixes
useless_attribute
: permit allowingwildcard_imports
andenum_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 #5920- Fix false positive in
borrow_interior_mutable_const
when referencing a field behind a pointer #5949 doc_markdown
: allow using "GraphQL" without backticks #5996to_string_in_display
: avoid linting when callingto_string()
on anything that is notself
#5971indexing_slicing
andout_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 #5903- Restrict
unnecessary_sort_by
to non-reference, Copy types #6006 - Avoid suggesting
from_bits
/to_bits
in const contexts intransmute_int_to_float
#5919 declare_interior_mutable_const
andborrow_interior_mutable_const
: improve detection of interior mutable types #6046
Suggestion Fixes/Improvements
let_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
andfloat_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 #5992- Do not suggest empty format strings in
print_with_newline
andwrite_with_newline
#6042 unit_arg
: improve the readability of the suggestion #5931stable_sort_primitive
: print the type that is being sorted in the lint message #5935- Show line count and max lines in
too_many_lines
lint message #6009 - Keep parentheses in the suggestion of
useless_conversion
where applicable #5900 option_map_unit_fn
andresult_map_unit_fn
: print the unit type()
explicitly #6024redundant_allocation
: suggest replacingRc<Box<T>>
withRc<T>
#5899- Make lint messages adhere to rustc dev guide conventions #5893
ICE Fixes
- Fix ICE in
repeat_once
#5948
Documentation Improvements
mutable_key_type
: explain potential for false positives when the interior mutable type is not accessed in theHash
implementation #6019unnecessary_mut_passed
: fix typo #5913- Add example of false positive to
ptr_arg
docs. #5885 box_vec
,vec_box
andborrowed_box
: add link to the documentation ofBox
#6023
Rust 1.47
Released 2020-10-08
View all 76 merged pull requests
New lints
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
#5301
Moves and Deprecations
- Deprecate
regex_macro
lint #5760 - Move
range_minus_one
topedantic
#5752
Enhancements
- Improve
needless_collect
by catchingcollect
calls followed byiter
orinto_iter
calls #5837 panic
,todo
,unimplemented
andunreachable
now detect calls with formatting #5811- Detect more cases of
suboptimal_flops
andimprecise_flops
#5443 - Handle asymmetrical implementations of
PartialEq
incmp_owned
#5701 - Make it possible to allow
unsafe_derive_deserialize
#5870 - Catch
ord.min(a).max(b)
where a < b inmin_max
#5871 - Make
clone_on_copy
suggestion machine applicable #5745 - Enable
len_zero
on ranges now thatis_empty
is stable on them #5961
False Positive Fixes
- Avoid triggering
or_fun_call
with const fns that take no arguments #5889 - Fix
redundant_closure_call
false positive for closures that have multiple calls #5800 - Don't lint cases involving
ManuallyDrop
inredundant_clone
#5824 - Treat a single expression the same as a single statement in the 2nd arm of a match in
single_match_else
#5771 - Don't trigger
unnested_or_patterns
if the featureor_patterns
is not enabled #5758 - Avoid linting if key borrows in
unnecessary_sort_by
#5756 - Consider
Try
impl forPoll
when generating suggestions intry_err
#5857 - Take input lifetimes into account in
manual_async_fn
#5859 - Fix multiple false positives in
type_repetition_in_bounds
and add a configuration option #5761 - Limit the
suspicious_arithmetic_impl
lint to one binary operation #5820
Suggestion Fixes/Improvements
- Improve readability of
shadow_unrelated
suggestion by truncating the RHS snippet #5788 - Suggest
filter_map
instead offlat_map
when mapping toOption
inmap_flatten
#5846 - Ensure suggestion is shown correctly for long method call chains in
iter_nth_zero
#5793 - Drop borrow operator in suggestions of
redundant_pattern_matching
#5815 - Add suggestion for
iter_skip_next
#5843 - Improve
collapsible_if
fix suggestion #5732
ICE Fixes
- Fix ICE caused by
needless_collect
#5877 - Fix ICE caused by
unnested_or_patterns
#5784
Documentation Improvements
- Fix grammar of
await_holding_lock
documentation #5748
Others
- Make lints adhere to the rustc dev guide #5888
Rust 1.46
Released 2020-08-27
View all 48 merged pull requests
New lints
Moves and Deprecations
- Move
cast_ptr_alignment
to pedantic #5667
Enhancements
- Improve
mem_replace_with_uninit
lint #5695
False Positive Fixes
len_zero
: Avoid linting ranges when therange_is_empty
feature is not enabled #5656let_and_return
: Don't lint if a temporary borrow is involved #5680reversed_empty_ranges
: Avoid lintingN..N
in for loop arguments in #5692if_same_then_else
: Don't assume multiplication is always commutative #5702disallowed_names
: Removebar
from the default configuration #5712redundant_pattern_matching
: Avoid suggesting non-const fn
calls in const contexts #5724
Suggestion Fixes/Improvements
- Fix suggestion of
unit_arg
lint, so that it suggest semantic equivalent code #4455 - Add auto applicable suggestion to
macro_use_imports
#5279
ICE Fixes
- Fix ICE in the
consts
module of Clippy #5709
Documentation Improvements
- Improve code examples across multiple lints #5664
Others
- Introduce a
--rustc
flag toclippy-driver
, which turnsclippy-driver
intorustc
and passes all the given arguments torustc
. This is especially useful for tools that need therustc
version Clippy was compiled with, instead of the Clippy version. E.g.clippy-driver --rustc --version
will print the output ofrustc --version
. #5178 - New issue templates now make it easier to complain if Clippy is too annoying or not annoying enough! #5735
Rust 1.45
Released 2020-07-16
View all 81 merged pull requests
New lints
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
#5550
Moves and Deprecations
- Downgrade
match_bool
to pedantic #5408 - Downgrade
match_wild_err_arm
to pedantic and update help messages. #5622 - Downgrade
useless_let_if_seq
to nursery. #5599 - Generalize
option_and_then_some
and rename tobind_instead_of_map
. #5529 - Rename
identity_conversion
touseless_conversion
. #5568 - Merge
block_in_if_condition_expr
andblock_in_if_condition_stmt
intoblocks_in_if_conditions
. #5563 - Merge
option_map_unwrap_or
,option_map_unwrap_or_else
andresult_map_unwrap_or_else
intomap_unwrap_or
. #5563 - Merge
option_unwrap_used
andresult_unwrap_used
intounwrap_used
. #5563 - Merge
option_expect_used
andresult_expect_used
intoexpect_used
. #5563 - Merge
for_loop_over_option
andfor_loop_over_result
intofor_loops_over_fallibles
. #5563
Enhancements
- Avoid running cargo lints when not enabled to improve performance. #5505
- Extend
useless_conversion
withTryFrom
andTryInto
. #5631 - Lint also in type parameters and where clauses in
unused_unit
. #5592 - Do not suggest deriving
Default
innew_without_default
. #5616
False Positive Fixes
while_let_on_iterator
#5525empty_line_after_outer_attr
#5609unnecessary_unwrap
#5558comparison_chain
#5596- Don't trigger
used_underscore_binding
in await desugaring. #5535 - Don't trigger
borrowed_box
on mutable references. #5491 - Allow
1 << 0
inidentity_op
. #5602 - Allow
use super::*;
glob imports inwildcard_imports
. #5564 - Whitelist more words in
doc_markdown
. #5611 - Skip dev and build deps in
multiple_crate_versions
. #5636 - Honor
allow
attribute on arguments inptr_arg
. #5647 - Honor lint level attributes for
redundant_field_names
,just_underscores_and_digits
,many_single_char_names
andsimilar_names
. #5651 - Ignore calls to
len
inor_fun_call
. #4429
Suggestion Improvements
- Simplify suggestions in
manual_memcpy
. #5536 - Fix suggestion in
redundant_pattern_matching
for macros. #5511 - Avoid suggesting
copied()
for mutable references inmap_clone
. #5530 - Improve help message for
clone_double_ref
. #5547
ICE Fixes
- Fix ICE caused in unwrap module. #5590
- Fix ICE on rustc test issue-69020-assoc-const-arith-overflow.rs #5499
Documentation
- Clarify the documentation of
unnecessary_mut_passed
. #5639 - Extend example for
unneeded_field_pattern
. #5541
Rust 1.44
Released 2020-06-04
View all 124 merged pull requests
New lints
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
#5294
Moves and Deprecations
- Deprecate
replace_consts
lint #5380 - Move
cognitive_complexity
to nursery #5428 - Move
useless_transmute
to nursery #5364 - Downgrade
inefficient_to_string
to pedantic #5412 - Downgrade
option_option
to pedantic #5401 - Downgrade
unreadable_literal
to pedantic #5419 - Downgrade
let_unit_value
to pedantic #5409 - Downgrade
trivially_copy_pass_by_ref
to pedantic #5410 - Downgrade
implicit_hasher
to pedantic #5411
Enhancements
- On nightly you can now use
cargo clippy --fix -Z unstable-options
to auto-fix lints that support this #5363 - Make
redundant_clone
also trigger on cases where the cloned value is not consumed. #5304 - Expand
integer_arithmetic
to also disallow bit-shifting #5430 option_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 #5365- Expand
clone_on_copy
to work in method call arguments as well #5441 redundant_pattern_matching
now also handleswhile let
#5483integer_arithmetic
now also lints references of integers #5329- Expand
float_cmp_const
to also work on arrays #5345 - Trigger
map_flatten
when map is called on anOption
#5473
False Positive Fixes
many_single_char_names
#5468should_implement_trait
#5437unused_self
#5387redundant_clone
#5453precedence
#5445suspicious_op_assign_impl
#5424needless_lifetimes
#5293redundant_pattern
#5287inconsistent_digit_grouping
#5451
Suggestion Improvements
- Improved
question_mark
lint suggestion so that it doesn't add redundantas_ref()
#5481 - Improve the suggested placeholder in
option_map_unit_fn
#5292 - Improve suggestion for
match_single_binding
when triggered inside a closure #5350
ICE Fixes
Documentation
- Fix documentation generation for configurable lints #5353
- Update documentation for
new_ret_no_self
#5448 - The documentation for
option_option
now suggest using a tri-state enum #5403 - Fix bit mask example in
verbose_bit_mask
documentation #5454 wildcard_imports
documentation now mentions thatuse ...::prelude::*
is not linted #5312
Rust 1.43
Released 2020-04-23
View all 91 merged pull requests
New lints
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
#5258
Moves and Deprecations
- Move
unneeded_field_pattern
to pedantic group #5200
Enhancements
- Make
missing_errors_doc
lint also trigger onasync
functions #5181 - Add more constants to
approx_constant
#5193 - Extend
question_mark
lint #5266
False Positive Fixes
Suggestion Improvements
- Improve suggestion when blocks of code are suggested #5134
ICE Fixes
misc_early
lints #5129missing_errors_doc
#5213- Fix ICE when evaluating
usize
s #5256
Documentation
- Improve documentation of
iter_nth_zero
- Add documentation pages for stable releases #5171
Others
- Clippy now completely runs on GitHub Actions #5190
Rust 1.42
Released 2020-03-12
View all 101 merged pull requests
New lints
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
#5067
Moves and Deprecations
- Move
transmute_float_to_int
from nursery to complexity group #5015 - Move
range_plus_one
to pedantic group #5057 - Move
debug_assert_with_mut_call
to nursery group #5106 - Deprecate
unused_label
#4930
Enhancements
- Lint vectored IO in
unused_io_amount
#5027 - Make
vec_box
configurable by adding a size threshold #5081 - Also lint constants in
cmp_nan
#4910 - Fix false negative in
expect_fun_call
#4915 - Fix false negative in
redundant_clone
#5017
False Positive Fixes
map_clone
#4937replace_consts
#4977let_and_return
#5008eq_op
#5079possible_missing_comma
#5083debug_assert_with_mut_call
#5106- Don't trigger
let_underscore_must_use
in external macros #5082 - Don't trigger
empty_loop
inno_std
crates #5086
Suggestion Improvements
option_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
#5032
ICE fixes
Documentation
- Improve documentation of
empty_enum
,replace_consts
,redundant_clone
, anditerator_step_by_zero
Rust 1.41
Released 2020-01-30
View all 74 merged pull requests
- New Lints:
- Remove plugin interface, see Inside Rust Blog for details #4714
- Move
use_self
to nursery group #4863 - Deprecate
into_iter_on_array
#4788 - Expand
string_lit_as_bytes
to also trigger when literal has escapes #4808 - Fix false positive in
comparison_chain
#4842 - Fix false positive in
while_immutable_condition
#4730 - Fix false positive in
explicit_counter_loop
#4803 - Fix false positive in
must_use_candidate
#4794 - Fix false positive in
print_with_newline
andwrite_with_newline
#4769 - Fix false positive in
derive_hash_xor_eq
#4766 - Fix false positive in
missing_inline_in_public_items
#4870 - Fix false positive in
string_add
#4880 - Fix false positive in
float_arithmetic
#4851 - Fix false positive in
cast_sign_loss
#4883 - Fix false positive in
manual_swap
#4877 - Fix ICEs occurring while checking some block expressions #4772
- Fix ICE in
use_self
#4776 - Fix ICEs related to
const_generics
#4780 - Display help when running
clippy-driver
without arguments, instead of ICEing #4810 - Clippy has its own ICE message now #4588
- Show deprecated lints in the documentation again #4757
- Improve Documentation by adding positive examples to some lints #4832
Rust 1.40
Released 2019-12-19
View all 76 merged pull requests
- New Lints:
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
#4657
- Move
redundant_clone
to perf group #4509 - Move
manual_mul_add
to nursery group #4736 - Expand
unit_cmp
to also work withassert_eq!
,debug_assert_eq!
,assert_ne!
anddebug_assert_ne!
#4613 - Expand
integer_arithmetic
to also detect mutating arithmetic like+=
#4585 - Fix false positive in
nonminimal_bool
#4568 - Fix false positive in
missing_safety_doc
#4611 - Fix false positive in
cast_sign_loss
#4614 - Fix false positive in
redundant_clone
#4509 - Fix false positive in
try_err
#4721 - Fix false positive in
toplevel_ref_arg
#4570 - Fix false positive in
multiple_inherent_impl
#4593 - Improve more suggestions and tests in preparation for the unstable
cargo fix --clippy
#4575 - Improve suggestion for
zero_ptr
#4599 - Improve suggestion for
explicit_counter_loop
#4691 - Improve suggestion for
mul_add
#4602 - Improve suggestion for
assertions_on_constants
#4635 - Fix ICE in
use_self
#4671 - Fix ICE when encountering const casts #4590
Rust 1.39
Released 2019-11-07
View all 100 merged pull requests
- New Lints:
- Deprecate
unused_collect
lint. This is fully covered by rustc's#[must_use]
oncollect
#4348 - Move
type_repetition_in_bounds
to pedantic group #4403 - Move
cast_lossless
to pedantic group #4539 temporary_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 #4469- Fix false positives in
block_in_if_*
lints #4458 - Fix false positive in
cast_lossless
#4473 - Fix false positive in
clone_on_copy
#4411 - Fix false positive in
deref_addrof
#4487 - Fix false positive in
too_many_lines
#4490 - Fix false positive in
new_ret_no_self
#4365 - Fix false positive in
manual_swap
#4478 - Fix false positive in
missing_const_for_fn
#4450 - Fix false positive in
extra_unused_lifetimes
#4477 - Fix false positive in
inherent_to_string
#4460 - Fix false positive in
map_entry
#4495 - Fix false positive in
unused_unit
#4445 - Fix false positive in
redundant_pattern
#4489 - Fix false positive in
wrong_self_convention
#4369 - Improve various suggestions and tests in preparation for the unstable
cargo fix --clippy
#4558 - Improve suggestions for
redundant_pattern_matching
#4352 - Improve suggestions for
explicit_write
#4544 - Improve suggestion for
or_fun_call
#4522 - Improve suggestion for
match_as_ref
#4446 - Improve suggestion for
unnecessary_fold_span
#4382 - Add suggestions for
unseparated_literal_suffix
#4401 - Add suggestions for
char_lit_as_u8
#4418
Rust 1.38
Released 2019-09-26
View all 76 merged pull requests
- New Lints:
- Move
{unnecessary,panicking}_unwrap
out of nursery #4307 - Extend the
use_self
lint to suggest uses ofSelf::Variant
#4308 - Improve suggestion for needless return #4262
- Add auto-fixable suggestion for
let_unit
#4337 - Fix false positive in
pub_enum_variant_names
andenum_variant_names
#4345 - Fix false positive in
cast_ptr_alignment
#4257 - Fix false positive in
string_lit_as_bytes
#4233 - Fix false positive in
needless_lifetimes
#4266 - Fix false positive in
float_cmp
#4275 - Fix false positives in
needless_return
#4274 - Fix false negative in
match_same_arms
#4246 - Fix incorrect suggestion for
needless_bool
#4335 - Improve suggestion for
cast_ptr_alignment
#4257 - Improve suggestion for
single_char_literal
#4361 - Improve suggestion for
len_zero
#4314 - Fix ICE in
implicit_hasher
#4268 - Fix allow bug in
trivially_copy_pass_by_ref
#4250
Rust 1.37
Released 2019-08-15
View all 72 merged pull requests
- New Lints:
- Renamed Lint:
const_static_lifetime
is now calledredundant_static_lifetimes
. The lint now covers statics in addition to consts #4162 match_same_arms
now warns for all identical arms, instead of only the first one #4102needless_return
now works with void functions #4220- Fix false positive in
redundant_closure
#4190 - Fix false positive in
useless_attribute
#4107 - Fix incorrect suggestion for
float_cmp
#4214 - Add suggestions for
print_with_newline
andwrite_with_newline
#4136 - Improve suggestions for
option_map_unwrap_or_else
andresult_map_unwrap_or_else
#4164 - Improve suggestions for
non_ascii_literal
#4119 - Improve diagnostics for
let_and_return
#4137 - Improve diagnostics for
trivially_copy_pass_by_ref
#4071 - Add macro check for
unreadable_literal
#4099
Rust 1.36
Released 2019-07-04
View all 81 merged pull requests
- New lints:
find_map
,filter_map_next
#4039 - New lint:
path_buf_push_overwrite
#3954 - Move
path_buf_push_overwrite
to the nursery #4013 - Split
redundant_closure
intoredundant_closure
andredundant_closure_for_method_calls
#4110 - Allow allowing of
toplevel_ref_arg
lint #4007 - Fix false negative in
or_fun_call
pertaining to nested constructors #4084 - Fix false positive in
or_fun_call
pertaining to enum variant constructors #4018 - Fix false positive in
useless_let_if_seq
pertaining to interior mutability #4035 - Fix false positive in
redundant_closure
pertaining to non-function types #4008 - Fix false positive in
let_and_return
pertaining to attributes onlet
s #4024 - Fix false positive in
module_name_repetitions
lint pertaining to attributes #4006 - Fix false positive on
assertions_on_constants
pertaining todebug_assert!
#3989 - Improve suggestion in
map_clone
to suggest.copied()
where applicable #3970 #4043 - Improve suggestion for
search_is_some
#4049 - Improve suggestion applicability for
naive_bytecount
#3984 - Improve suggestion applicability for
while_let_loop
#3975 - Improve diagnostics for
too_many_arguments
#4053 - Improve diagnostics for
cast_lossless
#4021 - Deal with macro checks in desugarings better #4082
- Add macro check for
unnecessary_cast
#4026 - Remove
approx_constant
's documentation's "Known problems" section. #4027 - Fix ICE in
suspicious_else_formatting
#3960 - Fix ICE in
decimal_literal_representation
#3931
Rust 1.35
Released 2019-05-20
- New lint:
drop_bounds
to detectT: Drop
bounds - Split
redundant_closure
intoredundant_closure
andredundant_closure_for_method_calls
#4110 - Rename
cyclomatic_complexity
tocognitive_complexity
, start work on making lint more practical for Rust code - Move
get_unwrap
to the restriction category - Improve suggestions for
iter_cloned_collect
- Improve suggestions for
cast_lossless
to suggest suffixed literals - Fix false positives in
print_with_newline
andwrite_with_newline
pertaining to raw strings - Fix false positive in
needless_range_loop
pertaining to structs without a.iter()
- Fix false positive in
bool_comparison
pertaining to non-bool types - Fix false positive in
redundant_closure
pertaining to differences in borrows - Fix false positive in
option_map_unwrap_or
on non-copy types - Fix false positives in
missing_const_for_fn
pertaining to macros and trait method impls - Fix false positive in
needless_pass_by_value
pertaining to procedural macros - Fix false positive in
needless_continue
pertaining to loop labels - Fix false positive for
boxed_local
pertaining to arguments moved into closures - Fix false positive for
use_self
in nested functions - Fix suggestion for
expect_fun_call
(https://github.com/rust-lang/rust-clippy/pull/3846) - Fix suggestion for
explicit_counter_loop
to deal with parenthesizing range variables - Fix suggestion for
single_char_pattern
to correctly escape single quotes - Avoid triggering
redundant_closure
in macros - ICE fixes: #3805, #3772, #3741
Rust 1.34
Released 2019-04-10
View all 61 merged pull requests
- New lint:
assertions_on_constants
to detect for exampleassert!(true)
- New lint:
dbg_macro
to detect uses of thedbg!
macro - New lint:
missing_const_for_fn
that can suggest functions to be madeconst
- New lint:
too_many_lines
to detect functions with excessive LOC. It can be configured using thetoo-many-lines-threshold
configuration. - New lint:
wildcard_enum_match_arm
to check for wildcard enum matches using_
- Expand
redundant_closure
to also work for methods (not only functions) - Fix ICEs in
vec_box
,needless_pass_by_value
andimplicit_hasher
- Fix false positive in
cast_sign_loss
- Fix false positive in
integer_arithmetic
- Fix false positive in
unit_arg
- Fix false positives in
implicit_return
- Add suggestion to
explicit_write
- Improve suggestions for
question_mark
lint - Fix incorrect suggestion for
cast_lossless
- Fix incorrect suggestion for
expect_fun_call
- Fix incorrect suggestion for
needless_bool
- Fix incorrect suggestion for
needless_range_loop
- Fix incorrect suggestion for
use_self
- Fix incorrect suggestion for
while_let_on_iterator
- Clippy is now slightly easier to invoke in non-cargo contexts. See #3665 for more details.
- We now have improved documentation on how to add new lints
Rust 1.33
Released 2019-02-26
View all 120 merged pull requests
- New lints:
implicit_return
,vec_box
,cast_ref_to_mut
- The
rust-clippy
repository is now part of therust-lang
org. - Rename
stutter
tomodule_name_repetitions
- Merge
new_without_default_derive
intonew_without_default
lint - Move
large_digit_groups
fromstyle
group topedantic
- Expand
bool_comparison
to check for<
,<=
,>
,>=
, and!=
comparisons against booleans - Expand
no_effect
to detect writes to constants such asA_CONST.field = 2
- Expand
redundant_clone
to work on struct fields - Expand
suspicious_else_formatting
to detectif .. {..} {..}
- Expand
use_self
to work on tuple structs and also in local macros - Fix ICE in
result_map_unit_fn
andoption_map_unit_fn
- Fix false positives in
implicit_return
- Fix false positives in
use_self
- Fix false negative in
clone_on_copy
- Fix false positive in
doc_markdown
- Fix false positive in
empty_loop
- Fix false positive in
if_same_then_else
- Fix false positive in
infinite_iter
- Fix false positive in
question_mark
- Fix false positive in
useless_asref
- Fix false positive in
wildcard_dependencies
- Fix false positive in
write_with_newline
- Add suggestion to
explicit_write
- Improve suggestions for
question_mark
lint - Fix incorrect suggestion for
get_unwrap
Rust 1.32
Released 2019-01-17
View all 71 merged pull requests
- New lints:
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
- Add support for
u128
andi128
to integer related lints - Add float support to
mistyped_literal_suffixes
- Fix false positives in
use_self
- Fix false positives in
missing_comma
- Fix false positives in
new_ret_no_self
- Fix false positives in
possible_missing_comma
- Fix false positive in
integer_arithmetic
in constant items - Fix false positive in
needless_borrow
- Fix false positive in
out_of_bounds_indexing
- Fix false positive in
new_without_default_derive
- Fix false positive in
string_lit_as_bytes
- Fix false negative in
out_of_bounds_indexing
- Fix false negative in
use_self
. It will now also check existential types - Fix incorrect suggestion for
redundant_closure_call
- Fix various suggestions that contained expanded macros
- Fix
bool_comparison
triggering 3 times on on on the same code - Expand
trivially_copy_pass_by_ref
to work on trait methods - Improve suggestion for
needless_range_loop
- Move
needless_pass_by_value
frompedantic
group tostyle
Rust 1.31
Released 2018-12-06
- Clippy has been relicensed under a dual MIT / Apache license. See #3093 for more information.
- With Rust 1.31, Clippy is no longer available via crates.io. The recommended
installation method is via
rustup component add clippy
. - New lints:
redundant_pattern_matching
,unnecessary_filter_map
,unused_unit
,map_flatten
,mem_replace_option_with_none
- Fix ICE in
if_let_redundant_pattern_matching
- Fix ICE in
needless_pass_by_value
when encountering a generic function argument with a lifetime parameter - Fix ICE in
needless_range_loop
- Fix ICE in
single_char_pattern
when encountering a constant value - Fix false positive in
assign_op_pattern
- Fix false positive in
boxed_local
on trait implementations - Fix false positive in
cmp_owned
- Fix false positive in
collapsible_if
when conditionals have comments - Fix false positive in
double_parens
- Fix false positive in
excessive_precision
- Fix false positive in
explicit_counter_loop
- Fix false positive in
fn_to_numeric_cast_with_truncation
- Fix false positive in
map_clone
- Fix false positive in
new_ret_no_self
- Fix false positive in
new_without_default
whennew
is unsafe - Fix false positive in
type_complexity
when using extern types - Fix false positive in
useless_format
- Fix false positive in
wrong_self_convention
- Fix incorrect suggestion for
excessive_precision
- Fix incorrect suggestion for
expect_fun_call
- Fix incorrect suggestion for
get_unwrap
- Fix incorrect suggestion for
useless_format
fn_to_numeric_cast_with_truncation
lint can be disabled again- Improve suggestions for
manual_memcpy
- Improve help message for
needless_lifetimes
Rust 1.30
Released 2018-10-25
View all 88 merged pull requests
- Deprecate
assign_ops
lint - New lints:
mistyped_literal_suffixes
,ptr_offset_with_cast
,needless_collect
,copy_iterator
cargo clippy -V
now includes the Clippy commit hash of the Rust Clippy component- Fix ICE in
implicit_hasher
- Fix ICE when encountering
println!("{}" a);
- Fix ICE when encountering a macro call in match statements
- Fix false positive in
default_trait_access
- Fix false positive in
trivially_copy_pass_by_ref
- Fix false positive in
similar_names
- Fix false positive in
redundant_field_name
- Fix false positive in
expect_fun_call
- Fix false negative in
identity_conversion
- Fix false negative in
explicit_counter_loop
- Fix
range_plus_one
suggestion and false negative print_with_newline
/write_with_newline
: don't warn about string with several\n
s in them- Fix
useless_attribute
to also whitelistunused_extern_crates
- Fix incorrect suggestion for
single_char_pattern
- Improve suggestion for
identity_conversion
lint - Move
explicit_iter_loop
andexplicit_into_iter_loop
fromstyle
group topedantic
- Move
range_plus_one
andrange_minus_one
fromnursery
group tocomplexity
- Move
shadow_unrelated
fromrestriction
group topedantic
- Move
indexing_slicing
frompedantic
group torestriction
Rust 1.29
Released 2018-09-13
- 🎉 🎉 Rust 1.29 is the first stable Rust that includes a bundled Clippy 🎉
🎉
You can now run
rustup component add clippy-preview
and thencargo clippy
to run Clippy. This should put an end to the continuous nightly upgrades for Clippy users. - Clippy now follows the Rust versioning scheme instead of its own
- Fix ICE when encountering a
while let (..) = x.iter()
construct - Fix false positives in
use_self
- Fix false positive in
trivially_copy_pass_by_ref
- Fix false positive in
useless_attribute
lint - Fix false positive in
print_literal
- Fix
use_self
regressions - Improve lint message for
neg_cmp_op_on_partial_ord
- Improve suggestion highlight for
single_char_pattern
- Improve suggestions for various print/write macro lints
- Improve website header
0.0.212 (2018-07-10)
- Rustup to rustc 1.29.0-nightly (e06c87544 2018-07-06)
0.0.211
- Rustup to rustc 1.28.0-nightly (e3bf634e0 2018-06-28)
0.0.210
- Rustup to rustc 1.28.0-nightly (01cc982e9 2018-06-24)
0.0.209
- Rustup to rustc 1.28.0-nightly (523097979 2018-06-18)
0.0.208
- Rustup to rustc 1.28.0-nightly (86a8f1a63 2018-06-17)
0.0.207
- Rustup to rustc 1.28.0-nightly (2a0062974 2018-06-09)
0.0.206
- Rustup to rustc 1.28.0-nightly (5bf68db6e 2018-05-28)
0.0.205
- Rustup to rustc 1.28.0-nightly (990d8aa74 2018-05-25)
- Rename
unused_lifetimes
toextra_unused_lifetimes
because of naming conflict with new rustc lint
0.0.204
- Rustup to rustc 1.28.0-nightly (71e87be38 2018-05-22)
0.0.203
- Rustup to rustc 1.28.0-nightly (a3085756e 2018-05-19)
- Clippy attributes are now of the form
clippy::cyclomatic_complexity
instead ofclippy(cyclomatic_complexity)
0.0.202
- Rustup to rustc 1.28.0-nightly (952f344cd 2018-05-18)
0.0.201
- Rustup to rustc 1.27.0-nightly (2f2a11dfc 2018-05-16)
0.0.200
- Rustup to rustc 1.27.0-nightly (9fae15374 2018-05-13)
0.0.199
- Rustup to rustc 1.27.0-nightly (ff2ac35db 2018-05-12)
0.0.198
- Rustup to rustc 1.27.0-nightly (acd3871ba 2018-05-10)
0.0.197
- Rustup to rustc 1.27.0-nightly (428ea5f6b 2018-05-06)
0.0.196
- Rustup to rustc 1.27.0-nightly (e82261dfb 2018-05-03)
0.0.195
- Rustup to rustc 1.27.0-nightly (ac3c2288f 2018-04-18)
0.0.194
- Rustup to rustc 1.27.0-nightly (bd40cbbe1 2018-04-14)
- New lints:
cast_ptr_alignment
,transmute_ptr_to_ptr
,write_literal
,write_with_newline
,writeln_empty_string
0.0.193
- Rustup to rustc 1.27.0-nightly (eeea94c11 2018-04-06)
0.0.192
- Rustup to rustc 1.27.0-nightly (fb44b4c0e 2018-04-04)
- New lint:
print_literal
0.0.191
- Rustup to rustc 1.26.0-nightly (ae544ee1c 2018-03-29)
- Lint audit; categorize lints as style, correctness, complexity, pedantic, nursery, restriction.
0.0.190
- Fix a bunch of intermittent cargo bugs
0.0.189
- Rustup to rustc 1.26.0-nightly (5508b2714 2018-03-18)
0.0.188
- Rustup to rustc 1.26.0-nightly (392645394 2018-03-15)
- New lint:
while_immutable_condition
0.0.187
- Rustup to rustc 1.26.0-nightly (322d7f7b9 2018-02-25)
- New lints:
redundant_field_names
,suspicious_arithmetic_impl
,suspicious_op_assign_impl
0.0.186
- Rustup to rustc 1.25.0-nightly (0c6091fbd 2018-02-04)
- Various false positive fixes
0.0.185
- Rustup to rustc 1.25.0-nightly (56733bc9f 2018-02-01)
- New lint:
question_mark
0.0.184
- Rustup to rustc 1.25.0-nightly (90eb44a58 2018-01-29)
- New lints:
double_comparisons
,empty_line_after_outer_attr
0.0.183
- Rustup to rustc 1.25.0-nightly (21882aad7 2018-01-28)
- New lint:
misaligned_transmute
0.0.182
- Rustup to rustc 1.25.0-nightly (a0dcecff9 2018-01-24)
- New lint:
decimal_literal_representation
0.0.181
- Rustup to rustc 1.25.0-nightly (97520ccb1 2018-01-21)
- New lints:
else_if_without_else
,option_option
,unit_arg
,unnecessary_fold
- Removed
unit_expr
- Various false positive fixes for
needless_pass_by_value
0.0.180
- Rustup to rustc 1.25.0-nightly (3f92e8d89 2018-01-14)
0.0.179
- Rustup to rustc 1.25.0-nightly (61452e506 2018-01-09)
0.0.178
- Rustup to rustc 1.25.0-nightly (ee220daca 2018-01-07)
0.0.177
- Rustup to rustc 1.24.0-nightly (250b49205 2017-12-21)
- New lint:
match_as_ref
0.0.176
- Rustup to rustc 1.24.0-nightly (0077d128d 2017-12-14)
0.0.175
- Rustup to rustc 1.24.0-nightly (bb42071f6 2017-12-01)
0.0.174
- Rustup to rustc 1.23.0-nightly (63739ab7b 2017-11-21)
0.0.173
- Rustup to rustc 1.23.0-nightly (33374fa9d 2017-11-20)
0.0.172
- Rustup to rustc 1.23.0-nightly (d0f8e2913 2017-11-16)
0.0.171
- Rustup to rustc 1.23.0-nightly (ff0f5de3b 2017-11-14)
0.0.170
- Rustup to rustc 1.23.0-nightly (d6b06c63a 2017-11-09)
0.0.169
- Rustup to rustc 1.23.0-nightly (3b82e4c74 2017-11-05)
- New lints:
just_underscores_and_digits
,result_map_unwrap_or_else
,transmute_bytes_to_str
0.0.168
- Rustup to rustc 1.23.0-nightly (f0fe716db 2017-10-30)
0.0.167
- Rustup to rustc 1.23.0-nightly (90ef3372e 2017-10-29)
- New lints:
const_static_lifetime
,erasing_op
,fallible_impl_from
,println_empty_string
,useless_asref
0.0.166
- Rustup to rustc 1.22.0-nightly (b7960878b 2017-10-18)
- New lints:
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
0.0.165
- Rust upgrade to rustc 1.22.0-nightly (0e6f4cf51 2017-09-27)
- New lint:
mut_range_bound
0.0.164
- Update to rustc 1.22.0-nightly (6c476ce46 2017-09-25)
- New lint:
int_plus_one
0.0.163
- Update to rustc 1.22.0-nightly (14039a42a 2017-09-22)
0.0.162
- Update to rustc 1.22.0-nightly (0701b37d9 2017-09-18)
- New lint:
chars_last_cmp
- Improved suggestions for
needless_borrow
,ptr_arg
,
0.0.161
- Update to rustc 1.22.0-nightly (539f2083d 2017-09-13)
0.0.160
- Update to rustc 1.22.0-nightly (dd08c3070 2017-09-12)
0.0.159
- Update to rustc 1.22.0-nightly (eba374fb2 2017-09-11)
- New lint:
clone_on_ref_ptr
0.0.158
- New lint:
manual_memcpy
cast_lossless
no longer has redundant parentheses in its suggestions- Update to rustc 1.22.0-nightly (dead08cb3 2017-09-08)
0.0.157 - 2017-09-04
- Update to rustc 1.22.0-nightly (981ce7d8d 2017-09-03)
- New lint:
unit_expr
0.0.156 - 2017-09-03
- Update to rustc 1.22.0-nightly (744dd6c1d 2017-09-02)
0.0.155
- Update to rustc 1.21.0-nightly (c11f689d2 2017-08-29)
- New lint:
infinite_iter
,maybe_infinite_iter
,cast_lossless
0.0.154
- Update to rustc 1.21.0-nightly (2c0558f63 2017-08-24)
- Fix
use_self
triggering inside derives - Add support for linting an entire workspace with
cargo clippy --all
- New lint:
naive_bytecount
0.0.153
- Update to rustc 1.21.0-nightly (8c303ed87 2017-08-20)
- New lint:
use_self
0.0.152
- Update to rustc 1.21.0-nightly (df511d554 2017-08-14)
0.0.151
- Update to rustc 1.21.0-nightly (13d94d5fa 2017-08-10)
0.0.150
- Update to rustc 1.21.0-nightly (215e0b10e 2017-08-08)
0.0.148
- Update to rustc 1.21.0-nightly (37c7d0ebb 2017-07-31)
- New lints:
unreadable_literal
,inconsistent_digit_grouping
,large_digit_groups
0.0.147
- Update to rustc 1.21.0-nightly (aac223f4f 2017-07-30)
0.0.146
- Update to rustc 1.21.0-nightly (52a330969 2017-07-27)
- Fixes false positives in
inline_always
- Fixes false negatives in
panic_params
0.0.145
- Update to rustc 1.20.0-nightly (afe145d22 2017-07-23)
0.0.144
- Update to rustc 1.20.0-nightly (086eaa78e 2017-07-15)
0.0.143
- Update to rustc 1.20.0-nightly (d84693b93 2017-07-09)
- Fix
cargo clippy
crashing ondylib
projects - Fix false positives around
nested_while_let
andnever_loop
0.0.142
- Update to rustc 1.20.0-nightly (067971139 2017-07-02)
0.0.141
- Rewrite of the
doc_markdown
lint. - Deprecated
range_step_by_zero
- New lint:
iterator_step_by_zero
- New lint:
needless_borrowed_reference
- Update to rustc 1.20.0-nightly (69c65d296 2017-06-28)
0.0.140 - 2017-06-16
- Update to rustc 1.19.0-nightly (258ae6dd9 2017-06-15)
0.0.139 — 2017-06-10
- Update to rustc 1.19.0-nightly (4bf5c99af 2017-06-10)
- Fix bugs with for loop desugaring
- Check for
AsRef
/AsMut
arguments inwrong_self_convention
0.0.138 — 2017-06-05
- Update to rustc 1.19.0-nightly (0418fa9d3 2017-06-04)
0.0.137 — 2017-06-05
- Update to rustc 1.19.0-nightly (6684d176c 2017-06-03)
0.0.136 — 2017—05—26
- Update to rustc 1.19.0-nightly (557967766 2017-05-26)
0.0.135 — 2017—05—24
- Update to rustc 1.19.0-nightly (5b13bff52 2017-05-23)
0.0.134 — 2017—05—19
- Update to rustc 1.19.0-nightly (0ed1ec9f9 2017-05-18)
0.0.133 — 2017—05—14
- Update to rustc 1.19.0-nightly (826d8f385 2017-05-13)
0.0.132 — 2017—05—05
- Fix various bugs and some ices
0.0.131 — 2017—05—04
- Update to rustc 1.19.0-nightly (2d4ed8e0c 2017-05-03)
0.0.130 — 2017—05—03
- Update to rustc 1.19.0-nightly (6a5fc9eec 2017-05-02)
0.0.129 — 2017-05-01
- Update to rustc 1.19.0-nightly (06fb4d256 2017-04-30)
0.0.128 — 2017-04-28
- Update to rustc 1.18.0-nightly (94e884b63 2017-04-27)
0.0.127 — 2017-04-27
- Update to rustc 1.18.0-nightly (036983201 2017-04-26)
- New lint:
needless_continue
0.0.126 — 2017-04-24
- Update to rustc 1.18.0-nightly (2bd4b5c6d 2017-04-23)
0.0.125 — 2017-04-19
- Update to rustc 1.18.0-nightly (9f2abadca 2017-04-18)
0.0.124 — 2017-04-16
- Update to rustc 1.18.0-nightly (d5cf1cb64 2017-04-15)
0.0.123 — 2017-04-07
- Fix various false positives
0.0.122 — 2017-04-07
- Rustup to rustc 1.18.0-nightly (91ae22a01 2017-04-05)
- New lint:
op_ref
0.0.121 — 2017-03-21
- Rustup to rustc 1.17.0-nightly (134c4a0f0 2017-03-20)
0.0.120 — 2017-03-17
- Rustup to rustc 1.17.0-nightly (0aeb9c129 2017-03-15)
0.0.119 — 2017-03-13
- Rustup to rustc 1.17.0-nightly (824c9ebbd 2017-03-12)
0.0.118 — 2017-03-05
- Rustup to rustc 1.17.0-nightly (b1e31766d 2017-03-03)
0.0.117 — 2017-03-01
- Rustup to rustc 1.17.0-nightly (be760566c 2017-02-28)
0.0.116 — 2017-02-28
- Fix
cargo clippy
on 64 bit windows systems
0.0.115 — 2017-02-27
- Rustup to rustc 1.17.0-nightly (60a0edc6c 2017-02-26)
- New lints:
zero_ptr
,never_loop
,mut_from_ref
0.0.114 — 2017-02-08
- Rustup to rustc 1.17.0-nightly (c49d10207 2017-02-07)
- Tests are now ui tests (testing the exact output of rustc)
0.0.113 — 2017-02-04
- Rustup to rustc 1.16.0-nightly (eedaa94e3 2017-02-02)
- New lint:
large_enum_variant
explicit_into_iter_loop
provides suggestions
0.0.112 — 2017-01-27
- Rustup to rustc 1.16.0-nightly (df8debf6d 2017-01-25)
0.0.111 — 2017-01-21
- Rustup to rustc 1.16.0-nightly (a52da95ce 2017-01-20)
0.0.110 — 2017-01-20
- Add badges and categories to
Cargo.toml
0.0.109 — 2017-01-19
- Update to rustc 1.16.0-nightly (c07a6ae77 2017-01-17)
0.0.108 — 2017-01-12
- Update to rustc 1.16.0-nightly (2782e8f8f 2017-01-12)
0.0.107 — 2017-01-11
- Update regex dependency
- Fix FP when matching
&&mut
by&ref
- Reintroduce
for (_, x) in &mut hash_map
->for x in hash_map.values_mut()
- New lints:
unused_io_amount
,forget_ref
,short_circuit_statement
0.0.106 — 2017-01-04
- Fix FP introduced by rustup in
wrong_self_convention
0.0.105 — 2017-01-04
- Update to rustc 1.16.0-nightly (468227129 2017-01-03)
- New lints:
deref_addrof
,double_parens
,pub_enum_variant_names
- Fix suggestion in
new_without_default
- FP fix in
absurd_extreme_comparisons
0.0.104 — 2016-12-15
- Update to rustc 1.15.0-nightly (8f02c429a 2016-12-15)
0.0.103 — 2016-11-25
- Update to rustc 1.15.0-nightly (d5814b03e 2016-11-23)
0.0.102 — 2016-11-24
- Update to rustc 1.15.0-nightly (3bf2be9ce 2016-11-22)
0.0.101 — 2016-11-23
- Update to rustc 1.15.0-nightly (7b3eeea22 2016-11-21)
- New lint:
string_extend_chars
0.0.100 — 2016-11-20
- Update to rustc 1.15.0-nightly (ac635aa95 2016-11-18)
0.0.99 — 2016-11-18
- Update to rustc 1.15.0-nightly (0ed951993 2016-11-14)
- New lint:
get_unwrap
0.0.98 — 2016-11-08
- Fixes an issue due to a change in how cargo handles
--sysroot
, which brokecargo clippy
0.0.97 — 2016-11-03
- For convenience,
cargo clippy
defines acargo-clippy
feature. This was previously added for a short time under the nameclippy
but removed for compatibility. cargo clippy --help
is more helping (and less helpful 😄)- Rustup to rustc 1.14.0-nightly (5665bdf3e 2016-11-02)
- New lints:
if_let_redundant_pattern_matching
,partialeq_ne_impl
0.0.96 — 2016-10-22
- Rustup to rustc 1.14.0-nightly (f09420685 2016-10-20)
- New lint:
iter_skip_next
0.0.95 — 2016-10-06
- Rustup to rustc 1.14.0-nightly (3210fd5c2 2016-10-05)
0.0.94 — 2016-10-04
- Fixes bustage on Windows due to forbidden directory name
0.0.93 — 2016-10-03
- Rustup to rustc 1.14.0-nightly (144af3e97 2016-10-02)
option_map_unwrap_or
andoption_map_unwrap_or_else
are now allowed by default.- New lint:
explicit_into_iter_loop
0.0.92 — 2016-09-30
- Rustup to rustc 1.14.0-nightly (289f3a4ca 2016-09-29)
0.0.91 — 2016-09-28
- Rustup to rustc 1.13.0-nightly (d0623cf7b 2016-09-26)
0.0.90 — 2016-09-09
- Rustup to rustc 1.13.0-nightly (f1f40f850 2016-09-09)
0.0.89 — 2016-09-06
- Rustup to rustc 1.13.0-nightly (cbe4de78e 2016-09-05)
0.0.88 — 2016-09-04
- Rustup to rustc 1.13.0-nightly (70598e04f 2016-09-03)
- The following lints are not new but were only usable through the
clippy
lint groups:filter_next
,for_loop_over_option
,for_loop_over_result
andmatch_overlapping_arm
. You should now be able to#[allow/deny]
them individually and they are available directly throughcargo clippy
.
0.0.87 — 2016-08-31
- Rustup to rustc 1.13.0-nightly (eac41469d 2016-08-30)
- New lints:
builtin_type_shadow
- Fix FP in
zero_prefixed_literal
and0b
/0o
0.0.86 — 2016-08-28
- Rustup to rustc 1.13.0-nightly (a23064af5 2016-08-27)
- New lints:
missing_docs_in_private_items
,zero_prefixed_literal
0.0.85 — 2016-08-19
- Fix ICE with
useless_attribute
useless_attribute
ignoresunused_imports
onuse
statements
0.0.84 — 2016-08-18
- Rustup to rustc 1.13.0-nightly (aef6971ca 2016-08-17)
0.0.83 — 2016-08-17
- Rustup to rustc 1.12.0-nightly (1bf5fa326 2016-08-16)
- New lints:
print_with_newline
,useless_attribute
0.0.82 — 2016-08-17
- Rustup to rustc 1.12.0-nightly (197be89f3 2016-08-15)
- New lint:
module_inception
0.0.81 — 2016-08-14
- Rustup to rustc 1.12.0-nightly (1deb02ea6 2016-08-12)
- New lints:
eval_order_dependence
,mixed_case_hex_literals
,unseparated_literal_suffix
- False positive fix in
too_many_arguments
- Addition of functionality to
needless_borrow
- Suggestions for
clone_on_copy
- Bug fix in
wrong_self_convention
- Doc improvements
0.0.80 — 2016-07-31
- Rustup to rustc 1.12.0-nightly (1225e122f 2016-07-30)
- New lints:
misrefactored_assign_op
,serde_api_misuse
0.0.79 — 2016-07-10
- Rustup to rustc 1.12.0-nightly (f93aaf84c 2016-07-09)
- Major suggestions refactoring
0.0.78 — 2016-07-02
- Rustup to rustc 1.11.0-nightly (01411937f 2016-07-01)
- New lints:
wrong_transmute
,double_neg
,filter_map
- For compatibility,
cargo clippy
does not defines theclippy
feature introduced in 0.0.76 anymore collapsible_if
now considersif let
0.0.77 — 2016-06-21
- Rustup to rustc 1.11.0-nightly (5522e678b 2016-06-20)
- New lints:
stutter
anditer_nth
0.0.76 — 2016-06-10
- Rustup to rustc 1.11.0-nightly (7d2f75a95 2016-06-09)
cargo clippy
now automatically defines theclippy
feature- New lint:
not_unsafe_ptr_arg_deref
0.0.75 — 2016-06-08
- Rustup to rustc 1.11.0-nightly (763f9234b 2016-06-06)
0.0.74 — 2016-06-07
- Fix bug with
cargo-clippy
JSON parsing - Add the
CLIPPY_DISABLE_DOCS_LINKS
environment variable to deactivate the “for further information visit lint-link” message.
0.0.73 — 2016-06-05
- Fix false positives in
useless_let_if_seq
0.0.72 — 2016-06-04
- Fix false positives in
useless_let_if_seq
0.0.71 — 2016-05-31
- Rustup to rustc 1.11.0-nightly (a967611d8 2016-05-30)
- New lint:
useless_let_if_seq
0.0.70 — 2016-05-28
- Rustup to rustc 1.10.0-nightly (7bddce693 2016-05-27)
invalid_regex
andtrivial_regex
can now warn onRegexSet::new
,RegexBuilder::new
and byte regexes
0.0.69 — 2016-05-20
- Rustup to rustc 1.10.0-nightly (476fe6eef 2016-05-21)
used_underscore_binding
has been madeAllow
temporarily
0.0.68 — 2016-05-17
- Rustup to rustc 1.10.0-nightly (cd6a40017 2016-05-16)
- New lint:
unnecessary_operation
0.0.67 — 2016-05-12
- Rustup to rustc 1.10.0-nightly (22ac88f1a 2016-05-11)
0.0.66 — 2016-05-11
- New
cargo clippy
subcommand - New lints:
assign_op_pattern
,assign_ops
,needless_borrow
0.0.65 — 2016-05-08
- Rustup to rustc 1.10.0-nightly (62e2b2fb7 2016-05-06)
- New lints:
float_arithmetic
,integer_arithmetic
0.0.64 — 2016-04-26
- Rustup to rustc 1.10.0-nightly (645dd013a 2016-04-24)
- New lints:
temporary_cstring_as_ptr
,unsafe_removed_from_name
, andmem_forget
0.0.63 — 2016-04-08
- Rustup to rustc 1.9.0-nightly (7979dd608 2016-04-07)
0.0.62 — 2016-04-07
- Rustup to rustc 1.9.0-nightly (bf5da36f1 2016-04-06)
0.0.61 — 2016-04-03
- Rustup to rustc 1.9.0-nightly (5ab11d72c 2016-04-02)
- New lint:
invalid_upcast_comparisons
0.0.60 — 2016-04-01
- Rustup to rustc 1.9.0-nightly (e1195c24b 2016-03-31)
0.0.59 — 2016-03-31
- Rustup to rustc 1.9.0-nightly (30a3849f2 2016-03-30)
- New lints:
logic_bug
,nonminimal_bool
- Fixed:
match_same_arms
now ignores arms with guards - Improved:
useless_vec
now warns onfor … in vec![…]
0.0.58 — 2016-03-27
- Rustup to rustc 1.9.0-nightly (d5a91e695 2016-03-26)
- New lint:
doc_markdown
0.0.57 — 2016-03-27
- Update to rustc 1.9.0-nightly (a1e29daf1 2016-03-25)
- Deprecated lints:
str_to_string
,string_to_string
,unstable_as_slice
,unstable_as_mut_slice
- New lint:
crosspointer_transmute
0.0.56 — 2016-03-23
- Update to rustc 1.9.0-nightly (0dcc413e4 2016-03-22)
- New lints:
many_single_char_names
andsimilar_names
0.0.55 — 2016-03-21
- Update to rustc 1.9.0-nightly (02310fd31 2016-03-19)
0.0.54 — 2016-03-16
- Update to rustc 1.9.0-nightly (c66d2380a 2016-03-15)
0.0.53 — 2016-03-15
- Add a configuration file
0.0.52
0.0.51 — 2016-03-13
- Add
str
to types considered bylen_zero
- New lints:
indexing_slicing
0.0.50 — 2016-03-11
- Update to rustc 1.9.0-nightly (c9629d61c 2016-03-10)
0.0.49 — 2016-03-09
- Update to rustc 1.9.0-nightly (eabfc160f 2016-03-08)
- New lints:
overflow_check_conditional
,unused_label
,new_without_default
0.0.48 — 2016-03-07
- Fixed: ICE in
needless_range_loop
with globals
0.0.47 — 2016-03-07
- Update to rustc 1.9.0-nightly (998a6720b 2016-03-07)
- New lint:
redundant_closure_call