Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
113 commits
Select commit Hold shift + click to select a range
227cce4
The command to update the test results is `cargo uibless`
samueltardieu Jun 11, 2026
d35c889
Count length of the first paragraph by its text
notriddle Jun 12, 2026
ee0e5a5
fix: type inference failure in mul_add.
Kokoro2336 May 9, 2026
518a89f
Rename `negated` to `is_negated_pat`.
theemathas Jun 23, 2026
a8bc1d7
Fix `unbalanced_ticks` when doc isn't contiguous
notriddle Jun 8, 2026
f08a46a
Add test case for split missing punctuation
notriddle Jun 8, 2026
490da02
Changelog for Clippy 1.97
alex-semenyuk Jun 27, 2026
b9a0911
arbitrary_source_item_ordering: add configurable trait impl ordering …
wasd243 Jul 3, 2026
04dafef
test(arbitrary_source_item_ordering): add comprehensive tests for `tr…
wasd243 Jul 5, 2026
6be69ec
Oh yeah, clippy too
scottmcm Jul 1, 2026
f6876f2
manual_filter: don't eat comments in the `and_then` suggestion
costajohnt Jul 7, 2026
62c9f92
allow mGCA const arguments to fall back to anon consts
khyperia Jul 8, 2026
79f4b6f
Rollup merge of #158666 - scottmcm:scalar-but-packed, r=workingjubilee
jhpratt Jul 9, 2026
5911c52
perf: Bail out of the disallowed_methods rule if the disallowed list …
connorshea Jul 9, 2026
a12bfc6
view-types: lower view types to HIR
scrabsha May 3, 2026
355b42a
Fix needless_collect suggests a suggestion that cannot be typed
AnHoang-alex Jul 9, 2026
0c209c1
Remove expect now that needless_collect is fixed
AnHoang-alex Jul 9, 2026
9a87d25
Attributes cleanup in tests [17/20]
samueltardieu May 21, 2026
85f9ced
Enable community reviews feature in triagebot
Urgau Jul 9, 2026
14f42a5
Merge commit '09382ed3c34e091d7705f96964e303b59978533c' into clippy-s…
flip1995 Jul 9, 2026
6f8e9ab
Enable community reviews feature in triagebot (#17390)
flip1995 Jul 9, 2026
c49f7dd
Set myself on vacation
samueltardieu Jul 9, 2026
9006d6c
Set myself on vacation (#17391)
samueltardieu Jul 9, 2026
9d78a79
book adding_lints.md: update link to msrvs
DanielEScherzer Jul 9, 2026
00e031c
Rollup merge of #157561 - notriddle:do-not-destroy-function-name, r=l…
jhpratt Jul 10, 2026
da8d7cb
Rollup merge of #158617 - khyperia:gca-syntax-flip, r=BoxyUwU
jhpratt Jul 10, 2026
3da892e
Rollup merge of #158739 - scrabsha:view-types/resolve-fields, r=oli-obk
jhpratt Jul 10, 2026
f00e53e
Remove `tokens` field from some AST nodes
nnethercote Jul 7, 2026
7267ddf
book adding_lints.md: update link to msrvs (#17394)
samueltardieu Jul 10, 2026
dcdde10
perf: Bail out of the `disallowed_methods` rule if the disallowed lis…
samueltardieu Jul 10, 2026
edce117
add new lints: `rest_pattern_accessible_field` and `unnecessary_rest_…
Erk- Jun 6, 2025
5b6af21
merge DefKind::InlineConst into AnonConst
khyperia Jul 10, 2026
523d841
Attributes cleanup in tests [17/20] (#17101)
ada4a Jul 10, 2026
66303a6
Attributes cleanup in tests [18/20]
samueltardieu May 21, 2026
5f34b6d
[Perf] Move `nonstandard_macro_braces` to pre-expansion
blyxyas Jul 9, 2026
884e9ab
Attributes cleanup in tests [18/20] (#17102)
ada4a Jul 10, 2026
e5251c9
Optimize `nonstandard_macro_braces` by 99.9683% [1.1b -> 351K] (#16808)
ada4a Jul 10, 2026
63f2678
test(`ref_binding_to_reference`): enable autofix
ada4a Jul 6, 2026
4ad3b14
`tests_outside_test_module`: put code in backticks in the lint message
ada4a Jul 6, 2026
9195a73
test(uninit_assumed_init): rename the test file to match lint name
ada4a Jul 10, 2026
ae491f3
`tests_outside_test_module`: put code in backticks in the lint messag…
samueltardieu Jul 10, 2026
8c03205
test(uninit_assumed_init): rename the test file to match lint name (#…
samueltardieu Jul 10, 2026
4e5744d
test(`ref_binding_to_reference`): enable autofix (#17371)
samueltardieu Jul 10, 2026
b6e111c
Auto merge of #159030 - flip1995:clippy-subtree-update, r=samueltardieu
bors Jul 10, 2026
3b04453
place FnDef behind a binder, instantiate w/ Dummy
Jun 17, 2026
63a5be9
Changelog for Clippy 1.97 🍹 (#17344)
flip1995 Jul 10, 2026
78d1003
Auto merge of #158942 - nnethercote:rm-ast-tokens-fields, r=petrochenkov
bors Jul 10, 2026
e3d1fea
Rollup merge of #158767 - khyperia:merge-inlineconst, r=BoxyUwU
jhpratt Jul 11, 2026
cab3dac
arbitrary_source_item_ordering: add configurable trait impl item orde…
samueltardieu Jul 11, 2026
732e6a3
Count length of the first paragraph by its text (#17215)
samueltardieu Jul 11, 2026
b2ff678
add new lints: `rest_pattern_accessible_field` and `unnecessary_rest_…
rustbot Jul 11, 2026
518f8ea
Add `definition_in_module_root` restriction lint
corygabrielsen May 19, 2026
6412d74
New lint: `definition_in_module_root` (#16965)
samueltardieu Jul 11, 2026
1ababc2
Add `as _` when the imported trait is not directly used
samueltardieu Jul 6, 2026
15edcdd
Enable `clippy::unused_trait_names` in dogfood
samueltardieu Jul 6, 2026
3bba7c4
Respect the configured MSRV in `implicit_saturating_sub`'s `if x != 0…
shulaoda Jul 11, 2026
75abcda
fix if_not_else firing on macro expanded conditions
Gri-ffin Jul 11, 2026
061b37a
Fix race in two Clippy UI tests.
Jul 11, 2026
430a22c
Fix race in two Clippy UI tests. (#17406)
samueltardieu Jul 11, 2026
33096b4
Shrink `ast::Expr`
nnethercote Jul 3, 2026
dd38e18
fix(non_zero_suggestions): don't lint signed div/rem as NonZero
Lfan-ke Jul 9, 2026
2f32ccf
fix: [`suboptimal_flops`] false negative with ambiguous float literal…
rustbot Jul 12, 2026
3f58335
The command to update the test results is `cargo uibless` (#17209)
ada4a Jul 12, 2026
8245e85
Update tools to rustc-demangle 1.2.8
teor2345 Jul 13, 2026
d728c37
ref_as_ptr: avoid invalid suggestions in const/static initializers
rabindra789 Jul 13, 2026
93c0223
partly disable unneeded_wildcard_pattern when rest_pattern_accessible…
Erk- Jul 13, 2026
ca697b3
Respect the configured MSRV in `implicit_saturating_sub`'s `if x != 0…
rustbot Jul 13, 2026
370a586
lints: `rest_pattern_accessible_fields`: fix typo `accesible` -> acce…
poliorcetics Jul 13, 2026
a3ba59a
Trigger `single_element_loop` if the block contains only a final expr…
lapla-cogito Feb 5, 2026
764f02f
Refactor `single_element_loop` to avoid `clippy::too_many_lines`
lapla-cogito Jul 13, 2026
8b6044b
Trigger `single_element_loop` if the block contains only a final expr…
Jarcho Jul 13, 2026
a1d390a
lints: `rest_pattern_accessible_fields`: fix typo `accesible` -> `acc…
Jarcho Jul 13, 2026
4814577
Partly disable `unneeded_wildcard_pattern` when `rest_pattern_accessi…
Jarcho Jul 13, 2026
fe2e36b
Rollup merge of #158632 - addiesh:superfisher, r=oli-obk
JonathanBrouwer Jul 13, 2026
3f3497b
Rollup merge of #159202 - teor2345:bump-rustc-demangle, r=Mark-Simula…
JonathanBrouwer Jul 13, 2026
107bf3f
Fix rustdoc with ModId refactors
camsteffen Jul 14, 2026
76efc6c
Fix clippy with ModId refactors
camsteffen Jul 14, 2026
5e03767
Auto merge of #158720 - nnethercote:Expr64, r=folkertdev
bors Jul 15, 2026
5f14555
Code simplification (collect has only one generic parameter)
AnHoang-alex Jul 15, 2026
eed04f6
clippy: avoid invalid `ref_as_ptr` suggestions in const/static initia…
llogiq Jul 15, 2026
9b5f92f
Rollup merge of #159197 - camsteffen:more-modid, r=petrochenkov
JonathanBrouwer Jul 15, 2026
ca36249
Rollup merge of #158302 - theemathas:neg-lit-lint, r=adwinwhite
JonathanBrouwer Jul 15, 2026
3ff2380
Add `block_scrutinee` lint
shivendra02467 Apr 15, 2026
4aadd11
Fix needless_collect suggests a suggestion that cannot be typed (#17383)
llogiq Jul 16, 2026
1244629
Improve an attribute check
nnethercote Jul 13, 2026
13bdce3
Remove `AttrItemKind`
nnethercote Jul 13, 2026
5d58075
Remove `sym::cfg_trace` and `sym::cfg_attr_trace`
nnethercote Jul 13, 2026
11671dc
Replace "early parsed" terminology
nnethercote Jul 14, 2026
a168c74
`manual_filter`: don't eat comments in the `and_then` suggestion (#17…
llogiq Jul 16, 2026
c3ec34d
fix(non_zero_suggestions): don't lint signed integer div/rem as NonZe…
llogiq Jul 17, 2026
fa9cfe7
Add `block_scrutinee` lint (#16855)
llogiq Jul 17, 2026
038a273
Require the use of `as _` for indirectly used traits in Clippy source…
llogiq Jul 17, 2026
21a39ad
feat: detect `== 0` on unsigned types as a `manual_clamp` lower bound
LesnyRumcajs Apr 3, 2026
9b14e55
feat: detect `== 0` on unsigned types as a `manual_clamp` lower bound…
rustbot Jul 18, 2026
b5369f9
Use `#[must_use]` determination from the compiler
samueltardieu Feb 24, 2026
8197719
Use better error message for `#[must_use]` types
samueltardieu Jun 3, 2026
bcf6667
Use `#[must_use]` determination from the compiler (#16633)
llogiq Jul 19, 2026
a1488fc
Attributes cleanup in tests [19/20]
samueltardieu May 21, 2026
02e9f20
fix(lint-page): add accessible labels to filters
eddiesr93 Jul 19, 2026
b9662e2
`cargo_common_metadata`: update link in documentation
DanielEScherzer Jul 19, 2026
248bb5f
Rewrite `min_ident_chars`.
Jarcho Jul 5, 2026
ea31765
Rewrite `min_ident_chars` (#17362)
llogiq Jul 20, 2026
1fb96b1
`cargo_common_metadata`: update link in documentation (#17435)
llogiq Jul 20, 2026
6109eeb
Attributes cleanup in tests [19/20] (#17103)
ada4a Jul 20, 2026
3f4c5f5
Fix `if_not_else` linting on macro expanded conditions (#17405)
llogiq Jul 20, 2026
120e493
Explain why the lint page accessibility test exists
eddiesr93 Jul 21, 2026
4b5b53b
Import extension traits for clippy and rustdoc
Jamesbarford Jul 21, 2026
0e85332
unify the AST repr of type const and const RHS
khyperia Jul 22, 2026
eaaf49c
fix(lint-page): add accessible labels to filters (#17434)
llogiq Jul 22, 2026
bf3d924
Merge remote-tracking branch 'upstream/master' into rustup
flip1995 Jul 23, 2026
4a940e5
Bump nightly version -> 2026-07-23
flip1995 Jul 23, 2026
ef124f6
Rustup (#17447)
flip1995 Jul 23, 2026
4bb6a6c
Merge commit 'ef124f64ef9e7c07b9f02927a17a14fd34148805' into clippy-s…
flip1995 Jul 23, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
115 changes: 114 additions & 1 deletion src/tools/clippy/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,115 @@ document.

## Unreleased / Beta / In Rust Nightly

[88f787...master](https://github.com/rust-lang/rust-clippy/compare/88f787...master)
[b147b68...master](https://github.com/rust-lang/rust-clippy/compare/b147b68...master)

## Rust 1.97

Current stable, released 2026-07-09

[View all 55 merged pull requests](https://github.com/rust-lang/rust-clippy/pulls?q=merged%3A2026-04-04T13%3A32%3A00Z..2026-05-13T17%3A35%3A43Z+base%3Amaster)

### New Lints

* Added [`manual_assert_eq`] to `pedantic`
[#16025](https://github.com/rust-lang/rust-clippy/pull/16025)
* Added [`manual_clear`] to `perf`
[#16617](https://github.com/rust-lang/rust-clippy/pull/16617)
* Added [`useless_borrows_in_formatting`] to `perf`
[#16523](https://github.com/rust-lang/rust-clippy/pull/16523)
* Added [`inline_trait_bounds`] to `restriction`
[#16486](https://github.com/rust-lang/rust-clippy/pull/16486)
* Added [`inline_modules`] to `restriction`
[#16732](https://github.com/rust-lang/rust-clippy/pull/16732)

### Moves and Deprecations

* Moved [`nonminimal_bool`] from `complexity` to `pedantic`
[#16761](https://github.com/rust-lang/rust-clippy/pull/16761)
* Moved [`overly_complex_bool_expr`] from `correctness` to `pedantic`
[#16761](https://github.com/rust-lang/rust-clippy/pull/16761)

### Enhancements

* [`unused_format_specs`] detect format width below the minimum output size for `#x`/`#o`/`#b`,
exponent, and pointer formats
[#16542](https://github.com/rust-lang/rust-clippy/pull/16542)
* [`zst_offset`] detect zero-sized `NonNull<T>` offset calculations
[#16888](https://github.com/rust-lang/rust-clippy/pull/16888)
* [`byte_char_slices`] enhance to cover arrays
[#16770](https://github.com/rust-lang/rust-clippy/pull/16770)
* [`manual_filter`] enhance to cover `and_then`
[#16456](https://github.com/rust-lang/rust-clippy/pull/16456)
* [`unneeded_wildcard_pattern`] add support for struct constructs
[#16733](https://github.com/rust-lang/rust-clippy/pull/16733)
* [`needless_late_init`] enhance to cover grouped assignments
[#16746](https://github.com/rust-lang/rust-clippy/pull/16746)
* [`needless_return_with_question_mark`] fix FN in async function bodies
[#16952](https://github.com/rust-lang/rust-clippy/pull/16952)
* [`needless_ifs`] fix FN when code contains a vertical tab (`\x0B`) whitespace
[#16845](https://github.com/rust-lang/rust-clippy/pull/16845)
* [`cloned_ref_to_slice_refs`] fix FN on `to_owned()`
[#16329](https://github.com/rust-lang/rust-clippy/pull/16329)
* [`for_kv_map`] fix FN when using `iter` and `iter_mut`
[#16830](https://github.com/rust-lang/rust-clippy/pull/16830)
* [`question_mark`] fix FN for manual unwrap with `if let` or `match`, when the scrutinee is behind
a reference, and when the binding is behind `ref` or `mut`
[#16769](https://github.com/rust-lang/rust-clippy/pull/16769)
* [`question_mark`] fix wrong suggestion when the match arm body is a destructuring assignment
[#16863](https://github.com/rust-lang/rust-clippy/pull/16863)
* [`expect_fun_call`] fix wrong suggestions for string slicing
[#16752](https://github.com/rust-lang/rust-clippy/pull/16752)
* [`println_empty_string`] fix wrong suggestion with non-parenthesis delimiters
[#16846](https://github.com/rust-lang/rust-clippy/pull/16846)
* [`int_plus_one`] parenthesize an `as` cast in the suggestion when the replacement operator is `<`
to avoid a parse error
[#16848](https://github.com/rust-lang/rust-clippy/pull/16848)
* [`bad_bit_mask`] truncate the constant to the target type before warning about impossible equality
[#16782](https://github.com/rust-lang/rust-clippy/pull/16782)
* [`manual_rotate`], [`map_with_unused_argument_over_ranges`], [`needless_bool`],
[`manual_is_power_of_two`], [`manual_div_ceil`], [`implicit_saturating_sub`], [`range_minus_one`],
[`range_plus_one`], [`manual_swap`], [`let_and_return`] fix wrongly unmangled macros
[#16443](https://github.com/rust-lang/rust-clippy/pull/16443)
* [`manual_noop_waker`] add an MSRV check
[#16850](https://github.com/rust-lang/rust-clippy/pull/16850)

### False Positive Fixes

* [`manual_option_zip`] fix FP when the outer param is used in a closure
[#16970](https://github.com/rust-lang/rust-clippy/pull/16970)
* [`non_canonical_clone_impl`] fix incompatibility with [`implicit_return`]
[#16949](https://github.com/rust-lang/rust-clippy/pull/16949)
* [`from_over_into`] don't lint when a blanket `From` impl would cause a coherence conflict
[#16881](https://github.com/rust-lang/rust-clippy/pull/16881)
* [`collapsible_match`] no longer suggests collapsing `pattern => { if test { body } }` into a match
guard when non-wildcard arms follow, as this changes the semantics of the match
[#16878](https://github.com/rust-lang/rust-clippy/pull/16878)
* [`unused_async`] fix FP for stubs with args
[#16832](https://github.com/rust-lang/rust-clippy/pull/16832)
* [`useless_conversion`] do not lint on `(a..b).into_iter()`, for compatibility with future range
syntax changes
[#16891](https://github.com/rust-lang/rust-clippy/pull/16891)
* [`bind_instead_of_map`] do not propose a rewrite when the only way to leave the closure is through
a divergent statement other than `return`
[#16867](https://github.com/rust-lang/rust-clippy/pull/16867)
* [`let_and_return`] do not trigger on the `let else` construct
[#16829](https://github.com/rust-lang/rust-clippy/pull/16829)
* [`fn_to_numeric_cast_any`] fix FP on a cast to a raw pointer
[#14109](https://github.com/rust-lang/rust-clippy/pull/14109)
* [`unnecessary_cast`] no longer suggests removing a cast that can cause a compilation error
[#16796](https://github.com/rust-lang/rust-clippy/pull/16796)
* [`unsafe_removed_from_name`] skip linting when renaming to `_`
[#16802](https://github.com/rust-lang/rust-clippy/pull/16802)

### ICE Fixes

* [`bad_bit_mask`] fix ICE for overloaded bit ops
[#16937](https://github.com/rust-lang/rust-clippy/pull/16937)

### Performance Improvements

* Fold all late lint passes into one statically-combined pass
[#17124](https://github.com/rust-lang/rust-clippy/pull/17124)

## Rust 1.96

Expand Down Expand Up @@ -6655,6 +6763,7 @@ Released 2018-09-13
[`blanket_clippy_restriction_lints`]: https://rust-lang.github.io/rust-clippy/master/index.html#blanket_clippy_restriction_lints
[`block_in_if_condition_expr`]: https://rust-lang.github.io/rust-clippy/master/index.html#block_in_if_condition_expr
[`block_in_if_condition_stmt`]: https://rust-lang.github.io/rust-clippy/master/index.html#block_in_if_condition_stmt
[`block_scrutinee`]: https://rust-lang.github.io/rust-clippy/master/index.html#block_scrutinee
[`blocks_in_conditions`]: https://rust-lang.github.io/rust-clippy/master/index.html#blocks_in_conditions
[`blocks_in_if_conditions`]: https://rust-lang.github.io/rust-clippy/master/index.html#blocks_in_if_conditions
[`bool_assert_comparison`]: https://rust-lang.github.io/rust-clippy/master/index.html#bool_assert_comparison
Expand Down Expand Up @@ -6732,6 +6841,7 @@ Released 2018-09-13
[`default_numeric_fallback`]: https://rust-lang.github.io/rust-clippy/master/index.html#default_numeric_fallback
[`default_trait_access`]: https://rust-lang.github.io/rust-clippy/master/index.html#default_trait_access
[`default_union_representation`]: https://rust-lang.github.io/rust-clippy/master/index.html#default_union_representation
[`definition_in_module_root`]: https://rust-lang.github.io/rust-clippy/master/index.html#definition_in_module_root
[`deprecated_cfg_attr`]: https://rust-lang.github.io/rust-clippy/master/index.html#deprecated_cfg_attr
[`deprecated_clippy_cfg_attr`]: https://rust-lang.github.io/rust-clippy/master/index.html#deprecated_clippy_cfg_attr
[`deprecated_semver`]: https://rust-lang.github.io/rust-clippy/master/index.html#deprecated_semver
Expand Down Expand Up @@ -7286,6 +7396,7 @@ Released 2018-09-13
[`repr_packed_without_abi`]: https://rust-lang.github.io/rust-clippy/master/index.html#repr_packed_without_abi
[`reserve_after_initialization`]: https://rust-lang.github.io/rust-clippy/master/index.html#reserve_after_initialization
[`rest_pat_in_fully_bound_structs`]: https://rust-lang.github.io/rust-clippy/master/index.html#rest_pat_in_fully_bound_structs
[`rest_pattern_accessible_field`]: https://rust-lang.github.io/rust-clippy/master/index.html#rest_pattern_accessible_field
[`result_expect_used`]: https://rust-lang.github.io/rust-clippy/master/index.html#result_expect_used
[`result_filter_map`]: https://rust-lang.github.io/rust-clippy/master/index.html#result_filter_map
[`result_large_err`]: https://rust-lang.github.io/rust-clippy/master/index.html#result_large_err
Expand Down Expand Up @@ -7451,6 +7562,7 @@ Released 2018-09-13
[`unnecessary_operation`]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_operation
[`unnecessary_option_map_or_else`]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_option_map_or_else
[`unnecessary_owned_empty_strings`]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_owned_empty_strings
[`unnecessary_rest_pattern`]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_rest_pattern
[`unnecessary_result_map_or_else`]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_result_map_or_else
[`unnecessary_safety_comment`]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_safety_comment
[`unnecessary_safety_doc`]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_safety_doc
Expand Down Expand Up @@ -7628,6 +7740,7 @@ Released 2018-09-13
[`too-many-arguments-threshold`]: https://doc.rust-lang.org/clippy/lint_configuration.html#too-many-arguments-threshold
[`too-many-lines-threshold`]: https://doc.rust-lang.org/clippy/lint_configuration.html#too-many-lines-threshold
[`trait-assoc-item-kinds-order`]: https://doc.rust-lang.org/clippy/lint_configuration.html#trait-assoc-item-kinds-order
[`trait-impl-item-order`]: https://doc.rust-lang.org/clippy/lint_configuration.html#trait-impl-item-order
[`trivial-copy-size-limit`]: https://doc.rust-lang.org/clippy/lint_configuration.html#trivial-copy-size-limit
[`type-complexity-threshold`]: https://doc.rust-lang.org/clippy/lint_configuration.html#type-complexity-threshold
[`unnecessary-box-size`]: https://doc.rust-lang.org/clippy/lint_configuration.html#unnecessary-box-size
Expand Down
2 changes: 1 addition & 1 deletion src/tools/clippy/book/src/development/adding_lints.md
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ define_Conf! {
}
```

[`clippy_utils::msrvs`]: https://doc.rust-lang.org/nightly/nightly-rustc/clippy_config/msrvs/index.html
[`clippy_utils::msrvs`]: https://doc.rust-lang.org/nightly/nightly-rustc/clippy_utils/msrvs/index.html

Afterwards update the documentation for the book as described in [Adding configuration to a lint](#adding-configuration-to-a-lint).

Expand Down
25 changes: 25 additions & 0 deletions src/tools/clippy/book/src/lint_configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -941,6 +941,7 @@ The minimum rust version that the project supports. Defaults to the `rust-versio
* [`filter_map_next`](https://rust-lang.github.io/rust-clippy/master/index.html#filter_map_next)
* [`from_over_into`](https://rust-lang.github.io/rust-clippy/master/index.html#from_over_into)
* [`if_then_some_else_none`](https://rust-lang.github.io/rust-clippy/master/index.html#if_then_some_else_none)
* [`implicit_saturating_sub`](https://rust-lang.github.io/rust-clippy/master/index.html#implicit_saturating_sub)
* [`index_refutable_slice`](https://rust-lang.github.io/rust-clippy/master/index.html#index_refutable_slice)
* [`inefficient_to_string`](https://rust-lang.github.io/rust-clippy/master/index.html#inefficient_to_string)
* [`io_other_error`](https://rust-lang.github.io/rust-clippy/master/index.html#io_other_error)
Expand Down Expand Up @@ -1168,6 +1169,30 @@ The order of associated items in traits.
* [`arbitrary_source_item_ordering`](https://rust-lang.github.io/rust-clippy/master/index.html#arbitrary_source_item_ordering)


## `trait-impl-item-order`
The required ordering of associated items in trait impls: purely alphabetical,
following the trait definition order, or accepting either.

Note that the trait definition order may change between versions of the
crate defining the trait without being considered a breaking change.

Examples:
When using trait definition item ordering:
```toml
trait-impl-item-order = "trait_item_ordering"
```
When using trait definition item ordering and alphabetical for fallbacks:
```toml
trait-impl-item-order = "alphabetical_or_trait_item_ordering"
```

**Default Value:** `"alphabetical"`

---
**Affected lints:**
* [`arbitrary_source_item_ordering`](https://rust-lang.github.io/rust-clippy/master/index.html#arbitrary_source_item_ordering)


## `trivial-copy-size-limit`
The maximum size (in bytes) to consider a `Copy` type for passing by value instead of by
reference.
Expand Down
30 changes: 24 additions & 6 deletions src/tools/clippy/clippy_config/src/conf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ use crate::types::{
DisallowedPath, DisallowedPathWithoutReplacement, InherentImplLintScope, MacroMatcher, MatchLintBehaviour,
PubUnderscoreFieldsBehaviour, Rename, SourceItemOrdering, SourceItemOrderingCategory,
SourceItemOrderingModuleItemGroupings, SourceItemOrderingModuleItemKind, SourceItemOrderingTraitAssocItemKind,
SourceItemOrderingTraitAssocItemKinds, SourceItemOrderingWithinModuleItemGroupings,
SourceItemOrderingTraitAssocItemKinds, SourceItemOrderingWithinModuleItemGroupings, TraitImplItemOrder,
};
use clippy_utils::msrvs::Msrv;
use itertools::Itertools;
use itertools::Itertools as _;
use rustc_errors::Applicability;
use rustc_session::Session;
use rustc_span::edit_distance::edit_distance;
use rustc_span::{BytePos, Pos, SourceFile, Span, SyntaxContext};
use serde::de::{IgnoredAny, IntoDeserializer, MapAccess, Visitor};
use serde::{Deserialize, Deserializer, Serialize};
use rustc_span::{BytePos, Pos as _, SourceFile, Span, SyntaxContext};
use serde::de::{IgnoredAny, IntoDeserializer as _, MapAccess, Visitor};
use serde::{Deserialize, Deserializer as _, Serialize as _};
use std::collections::HashMap;
use std::fmt::{Debug, Display, Formatter};
use std::ops::Range;
Expand Down Expand Up @@ -796,6 +796,7 @@ define_Conf! {
filter_map_next,
from_over_into,
if_then_some_else_none,
implicit_saturating_sub,
index_refutable_slice,
inefficient_to_string,
io_other_error,
Expand Down Expand Up @@ -917,6 +918,23 @@ define_Conf! {
/// The order of associated items in traits.
#[lints(arbitrary_source_item_ordering)]
trait_assoc_item_kinds_order: SourceItemOrderingTraitAssocItemKinds = DEFAULT_TRAIT_ASSOC_ITEM_KINDS_ORDER.into(),
/// The required ordering of associated items in trait impls: purely alphabetical,
/// following the trait definition order, or accepting either.
///
/// Note that the trait definition order may change between versions of the
/// crate defining the trait without being considered a breaking change.
///
/// Examples:
/// When using trait definition item ordering:
/// ```toml
/// trait-impl-item-order = "trait_item_ordering"
/// ```
/// When using trait definition item ordering and alphabetical for fallbacks:
/// ```toml
/// trait-impl-item-order = "alphabetical_or_trait_item_ordering"
/// ```
#[lints(arbitrary_source_item_ordering)]
trait_impl_item_order: TraitImplItemOrder = TraitImplItemOrder::Alphabetical,
/// The maximum size (in bytes) to consider a `Copy` type for passing by value instead of by
/// reference.
#[default_text = "target_pointer_width"]
Expand Down Expand Up @@ -1160,7 +1178,7 @@ impl serde::de::Error for FieldError {
fn unknown_field(field: &str, expected: &'static [&'static str]) -> Self {
// List the available fields sorted and at least one per line, more if `CLIPPY_TERMINAL_WIDTH` is
// set and allows it.
use fmt::Write;
use fmt::Write as _;

let metadata = get_configuration_metadata();
let deprecated = metadata
Expand Down
2 changes: 1 addition & 1 deletion src/tools/clippy/clippy_config/src/metadata.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use itertools::Itertools;
use itertools::Itertools as _;
use std::fmt;

#[derive(Debug, Clone, Default)]
Expand Down
9 changes: 9 additions & 0 deletions src/tools/clippy/clippy_config/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -706,3 +706,12 @@ pub enum InherentImplLintScope {
File,
Module,
}

/// Represents the ordering requirement for associated items in trait impls.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Deserialize, Serialize)]
#[serde(rename_all = "snake_case")]
pub enum TraitImplItemOrder {
Alphabetical,
TraitItemOrdering,
AlphabeticalOrTraitItemOrdering,
}
4 changes: 2 additions & 2 deletions src/tools/clippy/clippy_dev/src/deprecate_lint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ pub fn deprecate<'cx>(cx: ParseCx<'cx>, clippy_version: Version, name: &'cx str,
if remove_lint_declaration(name, &mod_path, &mut lints).unwrap_or(false) {
generate_lint_files(UpdateMode::Change, &lints, &deprecated_lints, &renamed_lints);
println!("info: `{name}` has successfully been deprecated");
println!("note: you must run `cargo uitest` to update the test results");
println!("note: you must run `cargo uibless` to update the test results");
} else {
eprintln!("error: lint not found");
}
Expand Down Expand Up @@ -107,7 +107,7 @@ pub fn uplift<'cx, 'env: 'cx>(cx: ParseCx<'cx>, clippy_version: Version, old_nam
if remove_lint_declaration(old_name, &mod_path, &mut lints).unwrap_or(false) {
generate_lint_files(UpdateMode::Change, &lints, &deprecated_lints, &renamed_lints);
println!("info: `{old_name}` has successfully been uplifted");
println!("note: you must run `cargo uitest` to update the test results");
println!("note: you must run `cargo uibless` to update the test results");
} else {
eprintln!("error: lint not found");
}
Expand Down
2 changes: 1 addition & 1 deletion src/tools/clippy/clippy_dev/src/dogfood.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::utils::{cargo_cmd, run_exit_on_err};
use itertools::Itertools;
use itertools::Itertools as _;

/// # Panics
///
Expand Down
6 changes: 3 additions & 3 deletions src/tools/clippy/clippy_dev/src/fmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ use crate::utils::{
ErrAction, FileUpdater, UpdateMode, UpdateStatus, expect_action, run_with_output, split_args_for_threads,
walk_dir_no_dot_or_target,
};
use itertools::Itertools;
use itertools::Itertools as _;
use rustc_lexer::{FrontmatterAllowed, TokenKind, tokenize};
use std::fmt::Write;
use std::fmt::Write as _;
use std::fs;
use std::io::{self, Read};
use std::io::{self, Read as _};
use std::ops::ControlFlow;
use std::path::PathBuf;
use std::process::{self, Command, Stdio};
Expand Down
4 changes: 2 additions & 2 deletions src/tools/clippy/clippy_dev/src/generate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ use crate::parse::cursor::Cursor;
use crate::parse::{Lint, LintData, LintPass, VecBuf};
use crate::utils::{FileUpdater, UpdateMode, UpdateStatus, slice_groups, update_text_region_fn};
use core::range::Range;
use itertools::Itertools;
use itertools::Itertools as _;
use std::collections::HashSet;
use std::fmt::Write;
use std::fmt::Write as _;
use std::path::{self, Path};

const GENERATED_FILE_COMMENT: &str = "// This file was generated by `cargo dev update_lints`.\n\
Expand Down
2 changes: 1 addition & 1 deletion src/tools/clippy/clippy_dev/src/release.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::utils::{FileUpdater, UpdateStatus, Version, parse_cargo_package};
use std::fmt::Write;
use std::fmt::Write as _;

static CARGO_TOML_FILES: &[&str] = &[
"clippy_config/Cargo.toml",
Expand Down
2 changes: 1 addition & 1 deletion src/tools/clippy/clippy_dev/src/sync.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::utils::{FileUpdater, update_text_region_fn};
use chrono::offset::Utc;
use std::fmt::Write;
use std::fmt::Write as _;

pub fn update_nightly() {
let date = Utc::now().format("%Y-%m-%d").to_string();
Expand Down
2 changes: 1 addition & 1 deletion src/tools/clippy/clippy_dev/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use core::range::Range;
use core::str::FromStr;
use std::ffi::OsStr;
use std::fs::{self, OpenOptions};
use std::io::{self, Read as _, Seek as _, SeekFrom, Write};
use std::io::{self, Read as _, Seek as _, SeekFrom, Write as _};
use std::path::{Path, PathBuf};
use std::process::{self, Command, Stdio};
use std::{env, thread};
Expand Down
2 changes: 1 addition & 1 deletion src/tools/clippy/clippy_lints/src/almost_complete_range.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use clippy_utils::msrvs::{self, MsrvStack};
use clippy_utils::source::{trim_span, walk_span_to_context};
use rustc_ast::ast::{Expr, ExprKind, LitKind, Pat, PatKind, RangeEnd, RangeLimits};
use rustc_errors::Applicability;
use rustc_lint::{EarlyContext, EarlyLintPass, LintContext};
use rustc_lint::{EarlyContext, EarlyLintPass, LintContext as _};
use rustc_session::impl_lint_pass;

declare_clippy_lint! {
Expand Down
Loading
Loading