Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
126 commits
Select commit Hold shift + click to select a range
c1de8ed
`incompatible_msrv`: Don't check the const version for functions refe…
Jarcho Sep 30, 2025
d860954
Remove boxes from ast Pat lists
camsteffen Sep 4, 2025
813eb08
`clippy_dev`: Move parsing code to it's own module.
Jarcho May 31, 2025
4f403f3
`clippy_dev`: Validate lint name format during argument parsing.
Jarcho Oct 10, 2025
88c0674
`clippy_dev`: Rename `RustSearcher` to `Cursor` and move it to its ow…
Jarcho Oct 10, 2025
5e36990
`clippy_dev`: Use the new ranges.
Jarcho Oct 10, 2025
422d459
`clippy_dev`: Capture token patterns by position and length.
Jarcho Oct 10, 2025
1b31b09
`clippy_dev`: Add specialized helpers for finding identifiers to the …
Jarcho Oct 11, 2025
3e1f862
clean-up tests
ada4a Oct 12, 2025
2fe9d4b
option_option: split part of diagnostic message into help message
ada4a Oct 12, 2025
5f0f7d8
return spans out of is_doc_comment to reduce reliance on .span() on a…
jdonszelmann Oct 14, 2025
1e1c1f3
Add multiple-inherent-impl tests
nickdrozd Oct 14, 2025
14b446c
Rollup merge of #147676 - jdonszelmann:span-is-doc-comment, r=Guillau…
matthiaskrgr Oct 15, 2025
2c8a9e2
Auto merge of #146221 - camsteffen:ast-boxes, r=cjgillot
bors Oct 16, 2025
d449806
`manual_unwrap_or(_default)`: don't lint if not safe to move scrutinee
zihan0822 Oct 4, 2025
8f61305
Merge commit 'd9fb15c4b1ebe9e7dc419e07f53af681d7860cbe' into clippy-s…
flip1995 Oct 16, 2025
6a0aa12
Fix clippy for impl_trait_header changes
camsteffen Oct 7, 2025
269679e
Update link to the Code of Conduct
alex-semenyuk Oct 17, 2025
1ecb18a
Update link to the Code of Conduct (#15903)
Alexendoo Oct 17, 2025
4463ba7
clean-up tests
ada4a Oct 12, 2025
b0ecbdf
fix `option_map_unit_fn_unfixable.rs`
ada4a Oct 12, 2025
98db098
improve the suggestion
ada4a Oct 12, 2025
c6426f5
Revert "fix(elidable_lifetime_names): avoid overlapping spans in sugg…
ada4a Oct 19, 2025
9ee9fd0
refactor(manual_div_ceil): move to under `operators/`
ada4a Oct 19, 2025
70de06f
clean-up a bit
ada4a Oct 19, 2025
c8c23bc
fix(empty_enum): don't lint if all variants happen to be `cfg`-d out
ada4a Oct 19, 2025
1ac3cc1
fix(empty_enum): don't lint if all variants happen to be `cfg`-d out …
samueltardieu Oct 20, 2025
95dd88d
refactor(manual_div_ceil_: move to under `operators/` (#15909)
samueltardieu Oct 20, 2025
5578908
chore(empty_enum): rename to `empty_enums`
ada4a Oct 19, 2025
4e3fa96
refactor(option_as_ref_cloned): move the `method_call` call out of th…
ada4a Oct 20, 2025
0702934
`manual_let_else` fix when expression finishes with '}'
teofr Oct 20, 2025
973e596
`option_option`: split part of diagnostic message into help message (…
Alexendoo Oct 20, 2025
b5c3ed0
refactor: Move to anstream + anstyle for styling
Muscraft Jun 4, 2025
960c01f
Add not-null pointer patterns to pattern types
oli-obk Jan 24, 2025
d9ecbb7
clean-up
ada4a Oct 20, 2025
c5215b6
clean-up a bit
ada4a Oct 21, 2025
a8fa9e1
clean-up
ada4a Oct 21, 2025
91dbaae
improve diagnostics
ada4a Oct 21, 2025
cb33ccd
improve diagnostics
ada4a Oct 21, 2025
97d6049
Mark range expr with desugaring
camsteffen Sep 10, 2025
a6e5159
fix: parenthesise the receiver if needed
ada4a Oct 21, 2025
37ebd4c
move the lint file to under `methods/`
ada4a Oct 21, 2025
81d2300
move to `methods/`, for real this time
ada4a Oct 21, 2025
039b40f
`match_as_ref`: improve diagnostics (#15928)
samueltardieu Oct 21, 2025
fb82de5
`manual_option_as_slice: improve diagnostics (#15926)
samueltardieu Oct 21, 2025
c6c71af
refactor(option_as_ref_cloned): move the `method_call` call out of th…
samueltardieu Oct 21, 2025
17f1942
Adapt the logic from `extra_unused_type_parameters`
ada4a Oct 19, 2025
bab7519
Update mod.rs
ZylosLumen Oct 22, 2025
fd20839
Make docs more clear (#15933)
samueltardieu Oct 22, 2025
5ff804e
misc: move infallible stuff out of the way
ada4a Oct 22, 2025
2bb3d0c
refactor(elidable_lifetimes): harmonize suggestion-building logic wit…
samueltardieu Oct 22, 2025
22bdd9f
fix(match_as_ref): suggest `as_ref` when the reference needs to be cast
ada4a Oct 21, 2025
0c592df
fix(match_as_ref): suggest `as_ref` when the reference needs to be ca…
samueltardieu Oct 22, 2025
2c1ceea
Auto merge of #147207 - Muscraft:anstyle-anstream, r=davidtwco
bors Oct 22, 2025
00f68d5
`clippy_dev`: parsing revamp 1/N (#15866)
samueltardieu Oct 22, 2025
de63d25
fix: Don't add diff symbol to unchanged lines
Muscraft Oct 22, 2025
fcfab5f
`clippy_dev`: Move all parsing within a parse context.
Jarcho Oct 10, 2025
7579e71
`clippy_dev`: Inline and simplify `read_src_with_module`.
Jarcho Oct 11, 2025
bae625f
`clippy_dev`: Allocate onto an arena when parsing.
Jarcho Oct 11, 2025
6026cc9
Replace NullOp::SizeOf and NullOp::AlignOf by lang items.
cjgillot Oct 16, 2025
26b12a9
Retire ast::TyAliasWhereClauses.
cjgillot Oct 15, 2025
cd5b0b6
Auto merge of #147793 - cjgillot:no-null-op, r=scottmcm,oli-obk
bors Oct 23, 2025
ab15129
Rollup merge of #147713 - cjgillot:where-cfg, r=fmease
jhpratt Oct 23, 2025
8d15b5f
Auto merge of #148014 - jhpratt:rollup-aglren3, r=jhpratt
bors Oct 23, 2025
82d729c
`clippy_dev`: Parsing revamp part 2/N (#15921)
samueltardieu Oct 23, 2025
09c3237
chore(empty_enum): rename to `empty_enums` (#15912)
dswij Oct 23, 2025
9fd359b
clean-up
ada4a Oct 21, 2025
9145cee
make the spans more precise
ada4a Oct 21, 2025
c238924
Revert "Auto merge of #146121 - Muscraft:filter-suggestion-parts, r=p…
lqd Oct 23, 2025
0cc1594
Fix trait method checking in book
samueltardieu Oct 23, 2025
9eba2cc
fix: `len_zero` FP on unstable methods
profetia Oct 16, 2025
8ff0cf8
Fix `len_zero` FP on unstable methods (#15894)
samueltardieu Oct 23, 2025
21d3b9d
split test files for `use_debug` and `print_stdout`
ada4a Oct 24, 2025
f975caa
Fix trait method checking in book (#15941)
Jarcho Oct 24, 2025
3dcf399
fix(`manual_let_else`): expressions ending with `'}'` (#15919)
Jarcho Oct 24, 2025
d1b51ea
`{option,result}_map_unit_fn`: fix and clean-up tests, make suggestio…
Jarcho Oct 24, 2025
622a77d
feat(search_is_some): Fix when the closure spans multiple lines
Oct 16, 2025
aae10d7
refactor(double_comparison): clean-up, simplify lint logic
ada4a Oct 26, 2025
ce2ef31
fix(needless_if): don't expand macro invocations in the suggestion
ada4a Oct 26, 2025
0ba9ba7
Prepare for mdbook 0.5
ehuss Oct 26, 2025
25cbcb4
refactor(lines_filter_map_ok): move to under `methods/` (#15925)
Jarcho Oct 26, 2025
05aaed9
Auto merge of #146069 - camsteffen:range-desugar-span, r=SparrowLii
bors Oct 27, 2025
12b011b
Lint precedence possible ambiguity between closure and method call
samueltardieu Mar 16, 2025
da89652
refactor(double_comparison): clean-up, simplify lint logic (#15955)
samueltardieu Oct 27, 2025
c5714b0
Prepare for mdbook 0.5 (#15965)
samueltardieu Oct 27, 2025
a0a347e
fix(needless_if): don't expand macro invocations in the suggestion (#…
samueltardieu Oct 27, 2025
640e118
chore(needless_if): rename to `needless_ifs`
ada4a Oct 26, 2025
d349b20
fix(use_debug): don't get confused by nested `Debug` impls
ada4a Oct 24, 2025
b0d93f1
chore(needless_if): rename to `needless_ifs` (#15961)
Alexendoo Oct 27, 2025
0029a91
Lint precedence possible ambiguity between closure and method call (#…
Alexendoo Oct 27, 2025
a5b3c44
Consider labels of inline asm as conditionally executed
samueltardieu Sep 14, 2025
ca168c0
`unnecessary_{find,filter}_map`: make diagnostic spans more precise (…
dswij Oct 27, 2025
0226fa9
Consider labels of inline asm as conditionally executed (#15676)
Alexendoo Oct 27, 2025
0ff3a38
Improve doc comment code language tag parsing, don't use a full parser
Alexendoo Oct 27, 2025
bc5bd29
Remove QPath::LangItem from for loops
camsteffen Sep 1, 2025
ae9d202
Remove QPath::LangItem from ranges
camsteffen Aug 17, 2025
930dfc8
Remove QPath::LangItem from async
camsteffen Aug 17, 2025
e2b3508
Remove QPath::LangItem from try
camsteffen Sep 1, 2025
a2d8955
Remove QPath::LangItem
camsteffen Sep 1, 2025
f144c6c
feat(search_is_some): Fix when the closure spans multiple lines (#15902)
Jarcho Oct 28, 2025
02e4516
fix(double_parens): don't lint in proc-macros
ada4a Oct 23, 2025
78db66e
Remove AssignDesugar span
camsteffen Oct 28, 2025
97e681f
Changelog for Clippy 1.91
alex-semenyuk Oct 25, 2025
e71b46f
refactor(invalid_upcast_comparisons): move to under `operators`
ada4a Oct 26, 2025
d74200a
refactor(invalid_upcast_comparisons): move to under `operators`, simp…
samueltardieu Oct 28, 2025
7012a5d
`incompatible_msrv`: Don't check the const MSRV for uncalled function…
samueltardieu Oct 29, 2025
90b34cb
put the operators in backticks in the diagnostics
ada4a Oct 25, 2025
967d2b1
chore(integer_division_remainder_used): move to under `operators`
ada4a Oct 25, 2025
35e55a6
`manual_unwrap_or(_default)`: don't lint if not safe to move scrutine…
flip1995 Oct 29, 2025
c95db07
test(while_immutable_condition): call the test file the same as the lint
ada4a Oct 29, 2025
7c86faa
test(while_immutable_condition): call the test file the same as the l…
llogiq Oct 29, 2025
5a90737
Add multiple-inherent-impl tests (#15886)
llogiq Oct 29, 2025
d05f74e
refactor(integer_division_remainder_used): move to under `operators` …
samueltardieu Oct 29, 2025
52fa003
Auto merge of #148193 - camsteffen:remove-qpath-langitem, r=cjgillot
bors Oct 30, 2025
5e7ce90
Improve doc comment code language tag parsing, don't use a full parse…
dswij Oct 30, 2025
b69d2ff
Changelog for Clippy 1.91 🎃 (#15971)
Jarcho Oct 31, 2025
bcc40ce
fix(double_parens): don't lint in proc-macros (#15939)
Jarcho Oct 31, 2025
e415911
fix(use_debug): don't get confused by nested `Debug` impls (#15946)
Jarcho Oct 31, 2025
88554d6
Remove/fix setTimeout logic in lints page
Alexendoo Oct 29, 2025
0b784f8
Remove/fix setTimeout logic in lints page (#15983)
Jarcho Oct 31, 2025
f64e401
Merge remote-tracking branch 'upstream/master' into rustup
flip1995 Oct 31, 2025
2b9c8f1
Bump nightly version -> 2025-10-31
flip1995 Oct 31, 2025
a531040
Bump Clippy version -> 0.1.93
flip1995 Oct 31, 2025
c936595
Rustup (#16000)
flip1995 Oct 31, 2025
534b81c
Merge commit 'c936595d17413c1f08e162e117e504fb4ed126e4' into clippy-s…
flip1995 Oct 31, 2025
be5093e
Update Cargo.lock
flip1995 Oct 31, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ checksum = "b94f61472cee1439c0b966b47e3aca9ae07e45d070759512cd390ea2bebc6675"

[[package]]
name = "clippy"
version = "0.1.92"
version = "0.1.93"
dependencies = [
"anstream",
"askama",
Expand All @@ -607,7 +607,7 @@ dependencies = [

[[package]]
name = "clippy_config"
version = "0.1.92"
version = "0.1.93"
dependencies = [
"clippy_utils",
"itertools",
Expand All @@ -630,7 +630,7 @@ dependencies = [

[[package]]
name = "clippy_lints"
version = "0.1.92"
version = "0.1.93"
dependencies = [
"arrayvec",
"cargo_metadata 0.18.1",
Expand Down Expand Up @@ -662,7 +662,7 @@ dependencies = [

[[package]]
name = "clippy_utils"
version = "0.1.92"
version = "0.1.93"
dependencies = [
"arrayvec",
"itertools",
Expand Down Expand Up @@ -1066,7 +1066,7 @@ dependencies = [

[[package]]
name = "declare_clippy_lint"
version = "0.1.92"
version = "0.1.93"

[[package]]
name = "derive-where"
Expand Down
85 changes: 85 additions & 0 deletions src/tools/clippy/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,89 @@ document.

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

## Rust 1.91

Current stable, released 2025-10-30

[View all 146 merged pull requests](https://github.com/rust-lang/rust-clippy/pulls?q=merged%3A2025-07-25T21%3A05%3A11Z..2025-09-04T22%3A34%3A27Z+base%3Amaster)

### New Lints

* Added [`possible_missing_else`] to `suspicious`
[#15317](https://github.com/rust-lang/rust-clippy/pull/15317)

### Moves and Deprecations

* Moved [`cognitive_complexity`] from `nursery` to `restriction`
[#15415](https://github.com/rust-lang/rust-clippy/pull/15415)
* Moved [`declare_interior_mutable_const`] from `style` to `suspicious`
[#15454](https://github.com/rust-lang/rust-clippy/pull/15454)
* Moved [`crosspointer_transmute`] from `complexity` to `suspicious`
[#15403](https://github.com/rust-lang/rust-clippy/pull/15403)

### Enhancements

* [`excessive_precision`] added `const_literal_digits_threshold` option to suppress overly precise constants.
[#15193](https://github.com/rust-lang/rust-clippy/pull/15193)
* [`unwrap_in_result`] rewritten for better accuracy; now lints on `.unwrap()` and `.expect()`
directly and no longer mixes `Result` and `Option`.
[#15445](https://github.com/rust-lang/rust-clippy/pull/15445)
* [`panic`] now works in `const` contexts.
[#15565](https://github.com/rust-lang/rust-clippy/pull/15565)
* [`implicit_clone`] now also lints `to_string` calls (merging [`string_to_string`] behavior).
[#14177](https://github.com/rust-lang/rust-clippy/pull/14177)
* [`collapsible_match`] improved suggestions to handle necessary ref/dereferencing.
[#14221](https://github.com/rust-lang/rust-clippy/pull/14221)
* [`map_identity`] now suggests making variables mutable when required; recognizes tuple struct restructuring.
[#15261](https://github.com/rust-lang/rust-clippy/pull/15261)
* [`option_map_unit_fn`] preserves `unsafe` blocks in suggestions.
[#15570](https://github.com/rust-lang/rust-clippy/pull/15570)
* [`unnecessary_mut_passed`] provides structured, clearer fix suggestions.
[#15438](https://github.com/rust-lang/rust-clippy/pull/15438)
* [`float_equality_without_abs`] now checks `f16` and `f128` types.
[#15054](https://github.com/rust-lang/rust-clippy/pull/15054)
* [`doc_markdown`] expanded whitelist (`InfiniBand`, `RoCE`, `PowerPC`) and improved handling of
identifiers like NixOS.
[#15558](https://github.com/rust-lang/rust-clippy/pull/15558)
* [`clone_on_ref_ptr`] now suggests fully qualified paths to avoid resolution errors.
[#15561](https://github.com/rust-lang/rust-clippy/pull/15561)
* [`manual_assert`] simplifies boolean expressions in suggested fixes.
[#15368](https://github.com/rust-lang/rust-clippy/pull/15368)
* [`four_forward_slashes`] warns about bare CR in comments and avoids invalid autofixes.
[#15175](https://github.com/rust-lang/rust-clippy/pull/15175)

### False Positive Fixes

* [`alloc_instead_of_core`] fixed FP when `alloc` is an alias
[#15581](https://github.com/rust-lang/rust-clippy/pull/15581)
* [`needless_range_loop`] fixed FP and FN when meeting multidimensional array
[#15486](https://github.com/rust-lang/rust-clippy/pull/15486)
* [`semicolon_inside_block`] fixed FP when attribute over expr is not enabled
[#15476](https://github.com/rust-lang/rust-clippy/pull/15476)
* [`unnested_or_patterns`] fixed FP on structs with only shorthand field patterns
[#15343](https://github.com/rust-lang/rust-clippy/pull/15343)
* [`match_ref_pats`] fixed FP on match scrutinee of never type
[#15474](https://github.com/rust-lang/rust-clippy/pull/15474)
* [`infinite_loop`] fixed FP in async blocks that are not awaited
[#15157](https://github.com/rust-lang/rust-clippy/pull/15157)
* [`iter_on_single_items`] fixed FP on function pointers and let statements
[#15013](https://github.com/rust-lang/rust-clippy/pull/15013)

### ICE Fixes

* [`len_zero`] fix ICE when fn len has a return type without generic type params
[#15660](https://github.com/rust-lang/rust-clippy/pull/15660)

### Documentation Improvements

* [`cognitive_complexity`] corrected documentation to state lint is in `restriction`, not `nursery`
[#15563](https://github.com/rust-lang/rust-clippy/pull/15563)

### Performance Improvements

* [`doc_broken_link`] optimized by 99.77% (12M → 27k instructions)
[#15385](https://github.com/rust-lang/rust-clippy/pull/15385)

## Rust 1.90

Current stable, released 2025-09-18
Expand Down Expand Up @@ -6253,6 +6336,7 @@ Released 2018-09-13
[`empty_drop`]: https://rust-lang.github.io/rust-clippy/master/index.html#empty_drop
[`empty_enum`]: https://rust-lang.github.io/rust-clippy/master/index.html#empty_enum
[`empty_enum_variants_with_brackets`]: https://rust-lang.github.io/rust-clippy/master/index.html#empty_enum_variants_with_brackets
[`empty_enums`]: https://rust-lang.github.io/rust-clippy/master/index.html#empty_enums
[`empty_line_after_doc_comments`]: https://rust-lang.github.io/rust-clippy/master/index.html#empty_line_after_doc_comments
[`empty_line_after_outer_attr`]: https://rust-lang.github.io/rust-clippy/master/index.html#empty_line_after_outer_attr
[`empty_loop`]: https://rust-lang.github.io/rust-clippy/master/index.html#empty_loop
Expand Down Expand Up @@ -6583,6 +6667,7 @@ Released 2018-09-13
[`needless_else`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_else
[`needless_for_each`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_for_each
[`needless_if`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_if
[`needless_ifs`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_ifs
[`needless_late_init`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_late_init
[`needless_lifetimes`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
[`needless_match`]: https://rust-lang.github.io/rust-clippy/master/index.html#needless_match
Expand Down
2 changes: 1 addition & 1 deletion src/tools/clippy/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# The Rust Code of Conduct

The Code of Conduct for this repository [can be found online](https://www.rust-lang.org/conduct.html).
The Code of Conduct for this repository [can be found online](https://rust-lang.org/policies/code-of-conduct/).
2 changes: 1 addition & 1 deletion src/tools/clippy/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "clippy"
version = "0.1.92"
version = "0.1.93"
description = "A bunch of helpful lints to avoid common pitfalls in Rust"
repository = "https://github.com/rust-lang/rust-clippy"
readme = "README.md"
Expand Down
2 changes: 0 additions & 2 deletions src/tools/clippy/book/book.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
[book]
authors = ["The Rust Clippy Developers"]
language = "en"
multilingual = false
src = "src"
title = "Clippy Documentation"

[rust]
Expand Down
15 changes: 10 additions & 5 deletions src/tools/clippy/book/src/development/method_checking.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,13 @@ 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
if let hir::ExprKind::MethodCall(path, _, _, _) = &expr.kind
// Check if the name of this method is `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`)
// Check if the method belongs to the `sym::OurFancyTrait` trait.
// (for example, a `map` method could belong to user-defined trait instead of to `Iterator`)
// See the next section for more information.
&& cx.ty_based_def(self_arg).opt_parent(cx).is_diag_item(cx, sym::OurFancyTrait)
&& cx.ty_based_def(expr).opt_parent(cx).is_diag_item(cx, sym::OurFancyTrait)
{
println!("`expr` is a method call for `our_fancy_method`");
}
Expand All @@ -45,6 +44,12 @@ New symbols such as `our_fancy_method` need to be added to the `clippy_utils::sy
This module extends the list of symbols already provided by the compiler crates
in `rustc_span::sym`.

If a trait defines only one method (such as the `std::ops::Deref` trait, which only has the `deref()` method),
one might be tempted to omit the method name check. This would work, but is not always advisable because:
- If a new method (possibly with a default implementation) were to be added to the trait, there would be a risk of
matching the wrong method.
- Comparing symbols is very cheap and might prevent a more expensive lookup.

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

While sometimes we want to check whether a method is being called or not, other
Expand Down
1 change: 1 addition & 0 deletions src/tools/clippy/book/src/lint_configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -859,6 +859,7 @@ The minimum rust version that the project supports. Defaults to the `rust-versio
* [`io_other_error`](https://rust-lang.github.io/rust-clippy/master/index.html#io_other_error)
* [`iter_kv_map`](https://rust-lang.github.io/rust-clippy/master/index.html#iter_kv_map)
* [`legacy_numeric_constants`](https://rust-lang.github.io/rust-clippy/master/index.html#legacy_numeric_constants)
* [`len_zero`](https://rust-lang.github.io/rust-clippy/master/index.html#len_zero)
* [`lines_filter_map_ok`](https://rust-lang.github.io/rust-clippy/master/index.html#lines_filter_map_ok)
* [`manual_abs_diff`](https://rust-lang.github.io/rust-clippy/master/index.html#manual_abs_diff)
* [`manual_bits`](https://rust-lang.github.io/rust-clippy/master/index.html#manual_bits)
Expand Down
2 changes: 1 addition & 1 deletion src/tools/clippy/clippy_config/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "clippy_config"
version = "0.1.92"
version = "0.1.93"
edition = "2024"
publish = false

Expand Down
1 change: 1 addition & 0 deletions src/tools/clippy/clippy_config/src/conf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -748,6 +748,7 @@ define_Conf! {
io_other_error,
iter_kv_map,
legacy_numeric_constants,
len_zero,
lines_filter_map_ok,
manual_abs_diff,
manual_bits,
Expand Down
32 changes: 16 additions & 16 deletions src/tools/clippy/clippy_dev/src/deprecate_lint.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use crate::update_lints::{DeprecatedLint, Lint, find_lint_decls, generate_lint_files, read_deprecated_lints};
use crate::parse::{DeprecatedLint, Lint, ParseCx};
use crate::update_lints::generate_lint_files;
use crate::utils::{UpdateMode, Version};
use std::ffi::OsStr;
use std::path::{Path, PathBuf};
Expand All @@ -13,21 +14,20 @@ use std::{fs, io};
/// # Panics
///
/// If a file path could not read from or written to
pub fn deprecate(clippy_version: Version, name: &str, reason: &str) {
if let Some((prefix, _)) = name.split_once("::") {
panic!("`{name}` should not contain the `{prefix}` prefix");
}

let mut lints = find_lint_decls();
let (mut deprecated_lints, renamed_lints) = read_deprecated_lints();
pub fn deprecate<'cx>(cx: ParseCx<'cx>, clippy_version: Version, name: &'cx str, reason: &'cx str) {
let mut lints = cx.find_lint_decls();
let (mut deprecated_lints, renamed_lints) = cx.read_deprecated_lints();

let Some(lint) = lints.iter().find(|l| l.name == name) else {
eprintln!("error: failed to find lint `{name}`");
return;
};

let prefixed_name = String::from_iter(["clippy::", name]);
match deprecated_lints.binary_search_by(|x| x.name.cmp(&prefixed_name)) {
let prefixed_name = cx.str_buf.with(|buf| {
buf.extend(["clippy::", name]);
cx.arena.alloc_str(buf)
});
match deprecated_lints.binary_search_by(|x| x.name.cmp(prefixed_name)) {
Ok(_) => {
println!("`{name}` is already deprecated");
return;
Expand All @@ -36,8 +36,8 @@ pub fn deprecate(clippy_version: Version, name: &str, reason: &str) {
idx,
DeprecatedLint {
name: prefixed_name,
reason: reason.into(),
version: clippy_version.rust_display().to_string(),
reason,
version: cx.str_buf.alloc_display(cx.arena, clippy_version.rust_display()),
},
),
}
Expand All @@ -61,8 +61,8 @@ pub fn deprecate(clippy_version: Version, name: &str, reason: &str) {
}
}

fn remove_lint_declaration(name: &str, path: &Path, lints: &mut Vec<Lint>) -> io::Result<bool> {
fn remove_lint(name: &str, lints: &mut Vec<Lint>) {
fn remove_lint_declaration(name: &str, path: &Path, lints: &mut Vec<Lint<'_>>) -> io::Result<bool> {
fn remove_lint(name: &str, lints: &mut Vec<Lint<'_>>) {
lints.iter().position(|l| l.name == name).map(|pos| lints.remove(pos));
}

Expand Down Expand Up @@ -135,14 +135,14 @@ fn remove_lint_declaration(name: &str, path: &Path, lints: &mut Vec<Lint>) -> io
);

assert!(
content[lint.declaration_range.clone()].contains(&name.to_uppercase()),
content[lint.declaration_range].contains(&name.to_uppercase()),
"error: `{}` does not contain lint `{}`'s declaration",
path.display(),
lint.name
);

// Remove lint declaration (declare_clippy_lint!)
content.replace_range(lint.declaration_range.clone(), "");
content.replace_range(lint.declaration_range, "");

// Remove the module declaration (mod xyz;)
let mod_decl = format!("\nmod {name};");
Expand Down
2 changes: 1 addition & 1 deletion src/tools/clippy/clippy_dev/src/fmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ fn run_rustfmt(update_mode: UpdateMode) {
.expect("invalid rustfmt path");
rustfmt_path.truncate(rustfmt_path.trim_end().len());

let args: Vec<_> = walk_dir_no_dot_or_target()
let args: Vec<_> = walk_dir_no_dot_or_target(".")
.filter_map(|e| {
let e = expect_action(e, ErrAction::Read, ".");
e.path()
Expand Down
11 changes: 9 additions & 2 deletions src/tools/clippy/clippy_dev/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
#![feature(
rustc_private,
exit_status_error,
if_let_guard,
new_range,
new_range_api,
os_str_slice,
os_string_truncate,
pattern,
rustc_private,
slice_split_once
)]
#![warn(
Expand All @@ -15,6 +18,7 @@
)]
#![allow(clippy::missing_panics_doc)]

extern crate rustc_arena;
#[expect(unused_extern_crates, reason = "required to link to rustc crates")]
extern crate rustc_driver;
extern crate rustc_lexer;
Expand All @@ -32,5 +36,8 @@ pub mod setup;
pub mod sync;
pub mod update_lints;

mod parse;
mod utils;
pub use utils::{ClippyInfo, UpdateMode};

pub use self::parse::{ParseCx, new_parse_cx};
pub use self::utils::{ClippyInfo, UpdateMode};
Loading
Loading