Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
127 commits
Select commit Hold shift + click to select a range
d254020
misc
ada4a Sep 3, 2025
a212bd4
misc: put the `: ` in the right place in the struct field suggestion
ada4a Sep 3, 2025
fba062b
fix(collapsible_match): exclude binding modes from struct field patte…
ada4a Sep 3, 2025
d6890e3
extend while_let_loop to loop { let else }
bend-n Sep 18, 2025
1d7c1af
Implement `volatile_composites` lint
Aug 23, 2025
4c128d9
Add lint unnecessary_option_map_or_else
pnuts93 Apr 21, 2025
e410d6f
Add test cases for closure binding and function identity
pnuts93 Jul 13, 2025
6d06db5
test: Subtract code_offset from width for ui_testing
Muscraft May 30, 2025
434fe18
fix(zero_repeat_side_effects): don't suggest unsuggestable types
ada4a Oct 3, 2025
8e3315f
misc: extend let-chain
ada4a Aug 3, 2025
c9ee445
extract the constant codepath
ada4a Aug 3, 2025
4423e05
fix: print actual consts when shifting by them
ada4a Aug 3, 2025
b249f13
feat: also detect non-consts
ada4a Aug 3, 2025
0ba022a
`legacy_numeric_constants`: add ctxt check for internal macro
zihan0822 Oct 4, 2025
843f4d8
Merge commit '2dc84cb744ad19d187871afb0385a616d80c209d' into clippy-s…
flip1995 Oct 6, 2025
4f21c99
extend `while_let_loop` to `loop { let else }` (#15701)
dswij Oct 6, 2025
f97b493
Remove no-rustfix
alex-semenyuk Oct 5, 2025
2c71638
Implement `volatile_composites` lint (#15686)
samueltardieu Oct 6, 2025
5b23bd4
Remove no-rustfixes (#15827)
samueltardieu Oct 6, 2025
5318883
Use expect for lint warnings
nickdrozd Sep 6, 2025
3f1e8cc
Rollup merge of #147165 - Muscraft:subtract-code-offset, r=davidtwco
matthiaskrgr Oct 7, 2025
f3c020c
Use expect for lint warnings (#15625)
samueltardieu Oct 7, 2025
c1f6124
`legacy_numeric_constants`: add ctxt check for internal macro (#15816)
y21 Oct 7, 2025
517ef60
Add `replace_box` lint
bluebear94 Oct 7, 2025
ea54123
fix(collapsible_match): exclude binding modes from struct field patte…
dswij Oct 7, 2025
0a2eece
Add `replace_box` lint (#14953)
samueltardieu Oct 7, 2025
0415d96
Migrate `needless_continue` to late pass
profetia Aug 23, 2025
7117bd9
fix: `needless_continue` FP when match type is not unit or never
profetia Aug 23, 2025
13bd9b5
fix: `needless_continue` wrongly unmangled macros
profetia Aug 23, 2025
f110f34
Fix `needless_continue` FP when match type is not unit or never (#15547)
samueltardieu Oct 7, 2025
e5e3bbd
extend the let-chain
ada4a Oct 7, 2025
01d2adc
replace `get_box_inner_type` with `Ty::boxed_ty`
ada4a Oct 7, 2025
30c73fe
`replace_box`: clean-up a bit (#15834)
samueltardieu Oct 7, 2025
f6336bc
rename `select_where_possible` and `select_all_or_error`
BoxyUwU Sep 27, 2025
8ef9057
chore: update manual_assert span suggestions
scottgerring Oct 8, 2025
d1be6d8
Make `obfuscated_if_else` a bit more type-safe
ada4a Oct 8, 2025
7b0c3d0
refactor(obfuscated_if_else): make a bit more type-safe (#15846)
Alexendoo Oct 8, 2025
80b886e
perf(get_unwrap): avoid calling `is_type_diagnostic_item` multiple times
ada4a Oct 8, 2025
c5a96d4
perf(get_unwrap): avoid calling `is_type_diagnostic_item` multiple ti…
samueltardieu Oct 8, 2025
69bd890
Honor `allow`/`expect` attributes on ADT and `impl Clone` nodes
samueltardieu Oct 8, 2025
e70b206
chore: multipart_suggestions for manual_assert (#13787)
y21 Oct 8, 2025
c425389
Cleanup: do not handle methods from several places
samueltardieu Sep 23, 2025
99b8106
Cleanup: do not handle methods from several places (#15751)
y21 Oct 9, 2025
6b697db
fix(clone_on_ref_ptr): only name the generic type if possible
ada4a Sep 23, 2025
6d0fafd
clean-up
ada4a Oct 9, 2025
62e1225
inline `find_matches_sugg` into `check_if_let`
ada4a Oct 9, 2025
27d5f5c
inline `is_if_let` into all callers
ada4a Oct 9, 2025
8519d49
inline `arms_without_last` into all callers
ada4a Oct 9, 2025
d1d5f0c
inline `arms` into all callers
ada4a Oct 9, 2025
83e2b3d
inline `find_matches_sugg` into `check_match`
ada4a Oct 9, 2025
bf5170a
match arm pats aren't `Option`al anymore
ada4a Oct 9, 2025
0efe3cf
split `arms` into first, last, and middle pats as slice
ada4a Oct 9, 2025
dd7f605
inline `{first,last}_{attrs,expr,pat,guard}` into all callers
ada4a Oct 9, 2025
0535908
final refactor and docs
ada4a Oct 9, 2025
343e780
Mark blyxyas on vacation
blyxyas Oct 9, 2025
e6febbd
Add lint unnecessary_option_map_or_else (#14662)
llogiq Oct 9, 2025
77ce8b8
Mark blyxyas on vacation (#15856)
blyxyas Oct 9, 2025
57913b4
Honor `allow`/`expect` attributes on ADT and `impl Clone` nodes (#15849)
blyxyas Oct 9, 2025
b71fe92
Check structs and enums for use_self
nickdrozd Aug 25, 2025
844fadb
Check structs and enums for `use_self` (#15566)
blyxyas Oct 9, 2025
1557560
Remove StatementKind::Deinit.
cjgillot Oct 10, 2025
6a08a85
Autolabel PR touching `declared_lints.rs` with `needs-fcp`
samueltardieu Oct 10, 2025
70d5c8c
Autolabel PR touching `declared_lints.rs` with `needs-fcp` (#15859)
samueltardieu Oct 10, 2025
e0e5d47
manual_unwrap_or: fix FP edge case
notriddle Oct 3, 2025
748a593
Add new utils for defninition identification.
Jarcho Sep 14, 2025
d32ef64
Remove `is_path_lang_item`
Jarcho Sep 15, 2025
cb32444
Remove `is_path_diagnostic_item`
Jarcho Sep 15, 2025
4914f59
Remove `is_type_diagnostic_item`
Jarcho Sep 15, 2025
fe13e06
Remove `is_type_ref_to_diagnostic_item`
Jarcho Sep 15, 2025
083b1c1
Remove `is_type_lang_item`
Jarcho Sep 15, 2025
e1a4c90
Remove `get_type_diagnostic_name`
Jarcho Sep 15, 2025
53783de
Remove `MaybePath`
Jarcho Sep 15, 2025
5b659ba
Remove `path_res`
Jarcho Sep 15, 2025
3ed7aa0
Remove `path_def_id`
Jarcho Sep 15, 2025
3f686a0
Remove `is_res_lang_ctor`
Jarcho Sep 15, 2025
53675ce
Remove `path_to_local`
Jarcho Sep 15, 2025
a6078f8
Remove `path_to_local_id`
Jarcho Sep 15, 2025
2e6729e
Remove `is_diag_trait_item`
Jarcho Sep 15, 2025
e78f86d
Remove `is_diag_item_method`
Jarcho Sep 15, 2025
d0be335
Remove `is_inherent_method_call`
Jarcho Sep 15, 2025
e69d88b
Remove `is_trait_method`
Jarcho Sep 15, 2025
6bfb524
Remove `is_trait_item`
Jarcho Sep 15, 2025
42f2ba1
fix(zero_repeat_side_effects): don't suggest unsuggestable types (#15…
Jarcho Oct 11, 2025
ebbbbeb
Replace all item identification utils (#15682)
samueltardieu Oct 11, 2025
097f2fd
add missing test for macros
ada4a Sep 24, 2025
f666547
Cleanup: rename `Applicability` variables/parameters
samueltardieu Sep 30, 2025
d10ea6e
Cleanup: rename `EarlyContext`/`LateContext` parameters
samueltardieu Sep 30, 2025
5de7da8
New internal lint: `unusual_names`
samueltardieu Sep 30, 2025
12e2542
Dereference argument of `manual_div_ceil()` if needed
samueltardieu Sep 18, 2025
16880f7
check earlier for `PartialEq` where `Rhs != Self`
ada4a Oct 1, 2025
3c02c0e
refactor(non_canonical_impls): lint starting from `impl`s
ada4a Sep 23, 2025
85ef017
book: encourage the use of `clippy_utils::sym`
samueltardieu Oct 11, 2025
9027625
book: use `Type::method` instead of `Type.method` to refer to methods
samueltardieu Oct 11, 2025
1ffd092
book: import `implements_trait` from `clippy_utils::ty`
samueltardieu Oct 11, 2025
bb5b5bc
feat(zero_repeat_side_effects): put the suggestion on two lines
ada4a Oct 6, 2025
6b076ca
feat(zero_repeat_side_effects): don't suggest unnecessary braces arou…
ada4a Oct 6, 2025
7c7bd6e
feat(zero_repeat_side_effects): don't suggest unnecessary braces arou…
samueltardieu Oct 11, 2025
85490d1
clean-up
ada4a Sep 7, 2025
3ae047e
restructure messages
ada4a Sep 7, 2025
38ac3d0
only lint on definitions, not use
ada4a Sep 7, 2025
99ce639
suggest replacing `Mutex::new` with `AtomicX::new`
ada4a Sep 7, 2025
e5fd571
realize that a test case is incorrect
ada4a Sep 7, 2025
778da58
suggest adjusting the type ascription
ada4a Sep 7, 2025
d66e5db
manual_unwrap_or: fix FP edge case (#15812)
blyxyas Oct 11, 2025
1f0b8b8
fix(clone_on_ref_ptr): only name the generic type if possible (#15740)
y21 Oct 11, 2025
35f8bff
book: cleanups (#15864)
Jarcho Oct 11, 2025
918b2d8
Diagnose liveness on MIR.
cjgillot Jun 10, 2025
9be2136
feat(multiple_inherent_impl): Add config option to target specific scope
paulmialane Oct 7, 2025
e786e00
actions/setup-node update
alex-semenyuk Oct 12, 2025
a8d1258
feat(multiple_inherent_impl): Add config option to target specific sc…
samueltardieu Oct 13, 2025
c6f2557
Update actions/setup-node version (#15874)
flip1995 Oct 13, 2025
1bd8cad
Allow `explicit_write` in tests
smoelius Oct 10, 2025
eee8ef8
New internal lint: `unusual_names` (#15794)
Jarcho Oct 14, 2025
9cc0291
`unnecessary_safety_comment` fix an ICE and
teofr Sep 15, 2025
b26a1aa
[`unnecessary_safety_comment`] Some fixes regarding comments above at…
blyxyas Oct 14, 2025
d230acd
Allow `explicit_write` in tests (#15862)
Jarcho Oct 15, 2025
ec8e8fd
refactor(non_canonical_impls): lint starting from `impl`s (#15749)
Jarcho Oct 15, 2025
8116b23
Dereference argument of `manual_div_ceil()` if needed (#15706)
Jarcho Oct 15, 2025
e8fec08
Restrict sysroot crate imports to those defined in this repo.
Diggsey Jul 6, 2025
ab9eb10
feat: `manual_rotate` also recognize non-consts (#15402)
llogiq Oct 15, 2025
8697533
overhaul `mutex_{atomic,integer}` (#15632)
llogiq Oct 15, 2025
00e5e1b
refactor(match_like_matches_macro): disentangle the if-let and match …
llogiq Oct 15, 2025
cf7aaa5
Merge remote-tracking branch 'upstream/master' into rustup
flip1995 Oct 16, 2025
9aa70f2
Bump nightly version -> 2025-10-16
flip1995 Oct 16, 2025
d9fb15c
Rustup (#15892)
flip1995 Oct 16, 2025
5056183
Merge commit 'd9fb15c4b1ebe9e7dc419e07f53af681d7860cbe' into clippy-s…
flip1995 Oct 16, 2025
4b0cfb6
Update Cargo.lock
flip1995 Oct 16, 2025
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
  •  
  •  
  •  
1 change: 1 addition & 0 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -645,6 +645,7 @@ version = "0.0.1"
dependencies = [
"clippy_config",
"clippy_utils",
"itertools",
"regex",
"rustc-semver",
]
Expand Down
4 changes: 2 additions & 2 deletions src/tools/clippy/.github/workflows/remark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ jobs:
persist-credentials: false

- name: Setup Node.js
uses: actions/setup-node@v4
uses: actions/setup-node@v5
with:
node-version: '18.x'
node-version: '20.x'

- name: Install remark
run: npm install remark-cli remark-lint remark-lint-maximum-line-length@^3.1.3 remark-preset-lint-recommended remark-gfm
Expand Down
377 changes: 270 additions & 107 deletions src/tools/clippy/CHANGELOG.md

Large diffs are not rendered by default.

4 changes: 1 addition & 3 deletions src/tools/clippy/book/src/development/adding_lints.md
Original file line number Diff line number Diff line change
Expand Up @@ -759,8 +759,7 @@ for some users. Adding a configuration is done in the following steps:
Here are some pointers to things you are likely going to need for every lint:

* [Clippy utils][utils] - Various helper functions. Maybe the function you need
is already in here ([`is_type_diagnostic_item`], [`implements_trait`],
[`snippet`], etc)
is already in here ([`implements_trait`], [`snippet`], etc)
* [Clippy diagnostics][diagnostics]
* [Let chains][let-chains]
* [`from_expansion`][from_expansion] and
Expand Down Expand Up @@ -790,7 +789,6 @@ get away with copying things from existing similar lints. If you are stuck,
don't hesitate to ask on [Zulip] or in the issue/PR.

[utils]: https://doc.rust-lang.org/nightly/nightly-rustc/clippy_utils/index.html
[`is_type_diagnostic_item`]: https://doc.rust-lang.org/nightly/nightly-rustc/clippy_utils/ty/fn.is_type_diagnostic_item.html
[`implements_trait`]: https://doc.rust-lang.org/nightly/nightly-rustc/clippy_utils/ty/fn.implements_trait.html
[`snippet`]: https://doc.rust-lang.org/nightly/nightly-rustc/clippy_utils/source/fn.snippet.html
[let-chains]: https://github.com/rust-lang/rust/pull/94927
Expand Down
45 changes: 23 additions & 22 deletions src/tools/clippy/book/src/development/common_tools_writing_lints.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ impl<'tcx> LateLintPass<'tcx> for MyStructLint {
// Check our expr is calling a method
if let hir::ExprKind::MethodCall(path, _, _self_arg, ..) = &expr.kind
// Check the name of this method is `some_method`
&& path.ident.name.as_str() == "some_method"
&& path.ident.name == sym::some_method
// Optionally, check the type of the self argument.
// - See "Checking for a specific type"
{
Expand All @@ -85,9 +85,8 @@ to check for. All of these methods only check for the base type, generic
arguments have to be checked separately.

```rust
use clippy_utils::ty::{is_type_diagnostic_item, is_type_lang_item};
use clippy_utils::paths;
use rustc_span::symbol::sym;
use clippy_utils::{paths, sym};
use clippy_utils::res::MaybeDef;
use rustc_hir::LangItem;

impl LateLintPass<'_> for MyStructLint {
Expand All @@ -97,12 +96,12 @@ impl LateLintPass<'_> for MyStructLint {

// 1. Using diagnostic items
// The last argument is the diagnostic item to check for
if is_type_diagnostic_item(cx, ty, sym::Option) {
if ty.is_diag_item(cx, sym::Option) {
// The type is an `Option`
}

// 2. Using lang items
if is_type_lang_item(cx, ty, LangItem::RangeFull) {
if ty.is_lang_item(cx, LangItem::RangeFull) {
// The type is a full range like `.drain(..)`
}

Expand All @@ -123,27 +122,29 @@ There are three ways to do this, depending on if the target trait has a
diagnostic item, lang item or neither.

```rust
use clippy_utils::sym;
use clippy_utils::ty::implements_trait;
use clippy_utils::is_trait_method;
use rustc_span::symbol::sym;

impl LateLintPass<'_> for MyStructLint {
fn check_expr(&mut self, cx: &LateContext<'_>, expr: &Expr<'_>) {
// 1. Using diagnostic items with the expression
// we use `is_trait_method` function from Clippy's utils
if is_trait_method(cx, expr, sym::Iterator) {
// method call in `expr` belongs to `Iterator` trait
}

// 2. Using lang items with the expression type
// 1. Get the `DefId` of the trait.
// via lang items
let trait_id = cx.tcx.lang_items().drop_trait();
// via diagnostic items
let trait_id = cx.tcx.get_diagnostic_item(sym::Eq);

// 2. Check for the trait implementation via the `implements_trait` util.
let ty = cx.typeck_results().expr_ty(expr);
if cx.tcx.lang_items()
// we are looking for the `DefId` of `Drop` trait in lang items
.drop_trait()
// then we use it with our type `ty` by calling `implements_trait` from Clippy's utils
.is_some_and(|id| implements_trait(cx, ty, id, &[])) {
// `expr` implements `Drop` trait
}
if trait_id.is_some_and(|id| implements_trait(cx, ty, id, &[])) {
// `ty` implements the trait.
}

// 3. If the trait requires additional generic arguments
let trait_id = cx.tcx.lang_items().eq_trait();
if trait_id.is_some_and(|id| implements_trait(cx, ty, id, &[ty])) {
// `ty` implements `PartialEq<Self>`
}
}
}
```
Expand Down Expand Up @@ -173,7 +174,7 @@ impl<'tcx> LateLintPass<'tcx> for MyTypeImpl {
// We can also check it has a parameter `self`
&& signature.decl.implicit_self.has_implicit_self()
// We can go further and even check if its return type is `String`
&& is_type_lang_item(cx, return_ty(cx, impl_item.hir_id), LangItem::String)
&& return_ty(cx, impl_item.hir_id).is_lang_item(cx, LangItem::String)
{
// ...
}
Expand Down
4 changes: 2 additions & 2 deletions src/tools/clippy/book/src/development/macro_expansions.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ before emitting suggestions to the end user to avoid false positives.

Several functions are available for working with macros.

### The `Span.from_expansion` method
### The `Span::from_expansion` method

We could utilize a `span`'s [`from_expansion`] method, which
detects if the `span` is from a macro expansion / desugaring.
Expand All @@ -50,7 +50,7 @@ if expr.span.from_expansion() {
}
```

### `Span.ctxt` method
### `Span::ctxt` method

The `span`'s context, given by the method [`ctxt`] and returning [SyntaxContext],
represents if the span is from a macro expansion and, if it is, which
Expand Down
19 changes: 11 additions & 8 deletions src/tools/clippy/book/src/development/method_checking.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,20 @@ the [`ExprKind`] that we can access from `expr.kind`:
```rust
use rustc_hir as hir;
use rustc_lint::{LateContext, LateLintPass};
use rustc_span::sym;
use clippy_utils::is_trait_method;
use clippy_utils::res::{MaybeDef, MaybeTypeckRes};
use clippy_utils::sym;

impl<'tcx> LateLintPass<'tcx> for OurFancyMethodLint {
fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx hir::Expr<'_>) {
// Check our expr is calling a method with pattern matching
if let hir::ExprKind::MethodCall(path, _, [self_arg, ..], _) = &expr.kind
// Check if the name of this method is `our_fancy_method`
&& path.ident.name.as_str() == "our_fancy_method"
&& path.ident.name == sym::our_fancy_method
// We can check the type of the self argument whenever necessary.
// (It's necessary if we want to check that method is specifically belonging to a specific trait,
// for example, a `map` method could belong to user-defined trait instead of to `Iterator`)
// See the next section for more information.
&& is_trait_method(cx, self_arg, sym::OurFancyTrait)
&& cx.ty_based_def(self_arg).opt_parent(cx).is_diag_item(cx, sym::OurFancyTrait)
{
println!("`expr` is a method call for `our_fancy_method`");
}
Expand All @@ -41,6 +41,10 @@ information on the pattern matching. As mentioned in [Define
Lints](defining_lints.md#lint-types), the `methods` lint type is full of pattern
matching with `MethodCall` in case the reader wishes to explore more.

New symbols such as `our_fancy_method` need to be added to the `clippy_utils::sym` module.
This module extends the list of symbols already provided by the compiler crates
in `rustc_span::sym`.

## Checking if a `impl` block implements a method

While sometimes we want to check whether a method is being called or not, other
Expand All @@ -56,11 +60,10 @@ Let us take a look at how we might check for the implementation of
`our_fancy_method` on a type:

```rust
use clippy_utils::ty::is_type_diagnostic_item;
use clippy_utils::return_ty;
use clippy_utils::{return_ty, sym};
use clippy_utils::res::MaybeDef;
use rustc_hir::{ImplItem, ImplItemKind};
use rustc_lint::{LateContext, LateLintPass};
use rustc_span::symbol::sym;

impl<'tcx> LateLintPass<'tcx> for MyTypeImpl {
fn check_impl_item(&mut self, cx: &LateContext<'tcx>, impl_item: &'tcx ImplItem<'_>) {
Expand All @@ -71,7 +74,7 @@ impl<'tcx> LateLintPass<'tcx> for MyTypeImpl {
// We can also check it has a parameter `self`
&& signature.decl.implicit_self.has_implicit_self()
// We can go even further and even check if its return type is `String`
&& is_type_diagnostic_item(cx, return_ty(cx, impl_item.hir_id), sym::String)
&& return_ty(cx, impl_item.hir_id).is_diag_item(cx, sym::String)
{
println!("`our_fancy_method` is implemented!");
}
Expand Down
9 changes: 5 additions & 4 deletions src/tools/clippy/book/src/development/trait_checking.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ providing the `LateContext` (`cx`), our expression at hand, and
the symbol of the trait in question:

```rust
use clippy_utils::sym;
use clippy_utils::ty::implements_trait;
use rustc_hir::Expr;
use rustc_lint::{LateContext, LateLintPass};
use rustc_span::symbol::sym;

impl LateLintPass<'_> for CheckIteratorTraitLint {
fn check_expr(&mut self, cx: &LateContext<'_>, expr: &Expr<'_>) {
Expand Down Expand Up @@ -53,7 +53,7 @@ For instance, if we want to examine whether an expression `expr` implements
we can check that the `Ty` of the `expr` implements the trait:

```rust
use clippy_utils::implements_trait;
use clippy_utils::ty::implements_trait;
use rustc_hir::Expr;
use rustc_lint::{LateContext, LateLintPass};

Expand All @@ -79,7 +79,8 @@ If neither diagnostic item nor a language item is available, we can use
Below, we check if the given `expr` implements [`core::iter::Step`](https://doc.rust-lang.org/std/iter/trait.Step.html):

```rust
use clippy_utils::{implements_trait, paths};
use clippy_utils::paths;
use clippy_utils::ty::implements_trait;
use rustc_hir::Expr;
use rustc_lint::{LateContext, LateLintPass};

Expand Down Expand Up @@ -124,8 +125,8 @@ The following code demonstrates how to do this:
```rust

use rustc_middle::ty::Ty;
use clippy_utils::sym;
use clippy_utils::ty::implements_trait;
use rustc_span::symbol::sym;

let ty = todo!("Get the `Foo` type to check for a trait implementation");
let borrow_id = cx.tcx.get_diagnostic_item(sym::Borrow).unwrap(); // avoid unwrap in real code
Expand Down
20 changes: 20 additions & 0 deletions src/tools/clippy/book/src/lint_configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -671,6 +671,16 @@ A list of paths to types that should be treated as if they do not contain interi
* [`mutable_key_type`](https://rust-lang.github.io/rust-clippy/master/index.html#mutable_key_type)


## `inherent-impl-lint-scope`
Sets the scope ("crate", "file", or "module") in which duplicate inherent `impl` blocks for the same type are linted.

**Default Value:** `"crate"`

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


## `large-error-threshold`
The maximum size of the `Err`-variant in a `Result` returned from a function

Expand Down Expand Up @@ -927,6 +937,16 @@ exported visibility, or whether they are marked as "pub".
* [`pub_underscore_fields`](https://rust-lang.github.io/rust-clippy/master/index.html#pub_underscore_fields)


## `recursive-self-in-type-definitions`
Whether the type itself in a struct or enum should be replaced with `Self` when encountering recursive types.

**Default Value:** `true`

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


## `semicolon-inside-block-ignore-singleline`
Whether to lint only if it's multiline.

Expand Down
18 changes: 12 additions & 6 deletions src/tools/clippy/clippy_config/src/conf.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use crate::ClippyConfiguration;
use crate::types::{
DisallowedPath, DisallowedPathWithoutReplacement, MacroMatcher, MatchLintBehaviour, PubUnderscoreFieldsBehaviour,
Rename, SourceItemOrdering, SourceItemOrderingCategory, SourceItemOrderingModuleItemGroupings,
SourceItemOrderingModuleItemKind, SourceItemOrderingTraitAssocItemKind, SourceItemOrderingTraitAssocItemKinds,
SourceItemOrderingWithinModuleItemGroupings,
DisallowedPath, DisallowedPathWithoutReplacement, InherentImplLintScope, MacroMatcher, MatchLintBehaviour,
PubUnderscoreFieldsBehaviour, Rename, SourceItemOrdering, SourceItemOrderingCategory,
SourceItemOrderingModuleItemGroupings, SourceItemOrderingModuleItemKind, SourceItemOrderingTraitAssocItemKind,
SourceItemOrderingTraitAssocItemKinds, SourceItemOrderingWithinModuleItemGroupings,
};
use clippy_utils::msrvs::Msrv;
use itertools::Itertools;
Expand Down Expand Up @@ -248,7 +248,7 @@ macro_rules! define_Conf {

#[derive(Deserialize)]
#[serde(field_identifier, rename_all = "kebab-case")]
#[allow(non_camel_case_types)]
#[expect(non_camel_case_types)]
enum Field { $($name,)* third_party, }

struct ConfVisitor<'a>(&'a SourceFile);
Expand Down Expand Up @@ -663,6 +663,9 @@ define_Conf! {
/// A list of paths to types that should be treated as if they do not contain interior mutability
#[lints(borrow_interior_mutable_const, declare_interior_mutable_const, ifs_same_cond, mutable_key_type)]
ignore_interior_mutability: Vec<String> = Vec::from(["bytes::Bytes".into()]),
/// Sets the scope ("crate", "file", or "module") in which duplicate inherent `impl` blocks for the same type are linted.
#[lints(multiple_inherent_impl)]
inherent_impl_lint_scope: InherentImplLintScope = InherentImplLintScope::Crate,
/// The maximum size of the `Err`-variant in a `Result` returned from a function
#[lints(result_large_err)]
large_error_threshold: u64 = 128,
Expand Down Expand Up @@ -809,6 +812,9 @@ define_Conf! {
/// exported visibility, or whether they are marked as "pub".
#[lints(pub_underscore_fields)]
pub_underscore_fields_behavior: PubUnderscoreFieldsBehaviour = PubUnderscoreFieldsBehaviour::PubliclyExported,
/// Whether the type itself in a struct or enum should be replaced with `Self` when encountering recursive types.
#[lints(use_self)]
recursive_self_in_type_definitions: bool = true,
/// Whether to lint only if it's multiline.
#[lints(semicolon_inside_block)]
semicolon_inside_block_ignore_singleline: bool = false,
Expand Down Expand Up @@ -1213,7 +1219,7 @@ mod tests {

for entry in toml_files {
let file = fs::read_to_string(entry.path()).unwrap();
#[allow(clippy::zero_sized_map_values)]
#[expect(clippy::zero_sized_map_values)]
if let Ok(map) = toml::from_str::<HashMap<String, IgnoredAny>>(&file) {
for name in map.keys() {
names.remove(name.as_str());
Expand Down
10 changes: 9 additions & 1 deletion src/tools/clippy/clippy_config/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ impl DisallowedPathEnum {
}

/// Creates a map of disallowed items to the reason they were disallowed.
#[allow(clippy::type_complexity)]
#[expect(clippy::type_complexity)]
pub fn create_disallowed_map<const REPLACEMENT_ALLOWED: bool>(
tcx: TyCtxt<'_>,
disallowed_paths: &'static [DisallowedPath<REPLACEMENT_ALLOWED>],
Expand Down Expand Up @@ -698,3 +698,11 @@ pub enum PubUnderscoreFieldsBehaviour {
PubliclyExported,
AllPubFields,
}

#[derive(Clone, Copy, Debug, PartialEq, Eq, Deserialize, Serialize)]
#[serde(rename_all = "lowercase")]
pub enum InherentImplLintScope {
Crate,
File,
Module,
}
2 changes: 1 addition & 1 deletion src/tools/clippy/clippy_dev/src/dogfood.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use itertools::Itertools;
/// # Panics
///
/// Panics if unable to run the dogfood test
#[allow(clippy::fn_params_excessive_bools)]
#[expect(clippy::fn_params_excessive_bools)]
pub fn dogfood(fix: bool, allow_dirty: bool, allow_staged: bool, allow_no_vcs: bool) {
run_exit_on_err(
"cargo test",
Expand Down
2 changes: 1 addition & 1 deletion src/tools/clippy/clippy_dev/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ enum DevCommand {
/// Which lint's page to load initially (optional)
lint: Option<String>,
},
#[allow(clippy::doc_markdown)]
#[expect(clippy::doc_markdown)]
/// Manually run clippy on a file or package
///
/// ## Examples
Expand Down
1 change: 0 additions & 1 deletion src/tools/clippy/clippy_dev/src/new_lint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,6 @@ fn create_lint_for_ty(lint: &LintData<'_>, enable_msrv: bool, ty: &str) -> io::R
Ok(())
}

#[allow(clippy::too_many_lines)]
fn setup_mod_file(path: &Path, lint: &LintData<'_>) -> io::Result<&'static str> {
let lint_name_upper = lint.name.to_uppercase();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ declare_clippy_lint! {
impl_lint_pass!(ArbitrarySourceItemOrdering => [ARBITRARY_SOURCE_ITEM_ORDERING]);

#[derive(Debug)]
#[allow(clippy::struct_excessive_bools)] // Bools are cached feature flags.
#[expect(clippy::struct_excessive_bools, reason = "Bools are cached feature flags")]
pub struct ArbitrarySourceItemOrdering {
assoc_types_order: SourceItemOrderingTraitAssocItemKinds,
enable_ordering_for_enum: bool,
Expand Down
Loading
Loading