Skip to content

Clippy subtree update #145056

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 116 commits into from
Aug 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
116 commits
Select commit Hold shift + click to select a range
8c6eea8
Extend `implicit_clone` to handle `to_string` calls
smoelius Feb 9, 2025
8a9adba
Fix adjacent code
smoelius Feb 9, 2025
8e5b0cd
Account for changes from issue 14396
smoelius Mar 20, 2025
6cea9cc
Replace `string_to_string` with `char_lit_as_u8` in driver.sh
smoelius Mar 10, 2025
9e9c917
fix: `iter_on_single_items` FP on function pointers
profetia Jun 7, 2025
20670f7
fix: `iter_on_single_item` FP on let stmt with type annotation
profetia Jun 7, 2025
31b9de6
fix: `let_unit_value` suggests wrongly for format macros
profetia Jun 20, 2025
0920486
Do not autofix comments containing bare CR
samueltardieu Jun 29, 2025
222ebd0
fix: `search_is_some` suggests wrongly inside macro
profetia Jun 25, 2025
ba6485d
fix: `match_single_binding` wrongly handles scope
profetia Jun 15, 2025
48df86f
fix: `match_single_binding` suggests wrongly inside binary expr
profetia Jul 15, 2025
af19ff8
fix `collapsable_if` when the inner `if` is in parens
folkertdev Jul 17, 2025
58c00f3
fix `collapsable_else_if` when the inner `if` is in parens
folkertdev Jul 17, 2025
9e50049
Split `possible_missing_else` from `suspicious_else_formatting`.
Jarcho Jul 20, 2025
6017fe6
expand the issue template for new lints
lolbinarycat Jul 24, 2025
a19b46d
fix markdown
lolbinarycat Jul 24, 2025
0aa92fd
fix ip_constant when call wrapped in extra parens
ComputerDruid Jun 18, 2025
da66180
Detect prefixed attributes as duplicated
isitreallyalive Jul 24, 2025
5c7418b
Merge commit '1db89a1b1ca87f24bf22d0bad21d14b2d81b3e99' into clippy-s…
flip1995 Jul 25, 2025
03986e6
Get myself back on assignment rotation
samueltardieu Jul 25, 2025
0397819
Get myself back on assignment rotation (#15346)
samueltardieu Jul 25, 2025
e910c0e
Deprecate `string_to_string`
smoelius Mar 28, 2025
f9ab9d0
fix ip_constant when call wrapped in extra parens (#15339)
llogiq Jul 26, 2025
31b6b66
Fix tooling
JonathanBrouwer Jul 7, 2025
651ca33
Detect prefixed attributes as duplicated (#15212)
y21 Jul 26, 2025
c78f3ae
fix: `empty_structs_with_brackets` suggests wrongly on generics
profetia Jul 27, 2025
81fc227
fix: `unnecessary_map_or` don't add parens if the parent expr comes f…
ada4a Jul 25, 2025
f126db4
Fix `empty_structs_with_brackets` suggests wrongly on generics (#15355)
y21 Jul 27, 2025
3174c05
fix: `unnecessary_map_or` don't add parens if the parent expr comes f…
y21 Jul 27, 2025
887b500
Fix `let_unit_value` suggests wrongly for format macros (#15085)
llogiq Jul 27, 2025
9339d8c
Fix typo non_std_lazy_statics.rs
smoelius Jul 27, 2025
4bfb6d3
Fix typo non_std_lazy_statics.rs (#15357)
samueltardieu Jul 27, 2025
f4f579f
Fix `match_single_binding` wrongly handles scope (#15060)
dswij Jul 28, 2025
18a13b1
Do not treat NixOS as a Pascal-cased identifier
samueltardieu Jul 28, 2025
938e79f
fix: `cast-lossless` should not suggest when casting type is from mac…
profetia Jul 27, 2025
a55517f
Fix `cast-lossless` should not suggest when casting type is from macr…
samueltardieu Jul 28, 2025
d73a6b7
Do not treat NixOS as a Pascal-cased identifier (#15361)
Alexendoo Jul 28, 2025
b074019
Rename trait_of_item -> trait_of_assoc
camsteffen Jul 25, 2025
86ff11e
Rename impl_of_method -> impl_of_assoc
camsteffen Jul 25, 2025
4f1044a
Do not specialize for `if_chain` any longer
samueltardieu Jul 28, 2025
431f95e
Fix typo in internal error message
samueltardieu Jul 28, 2025
7b3bd5b
Fix typo in internal error message (#15363)
dswij Jul 28, 2025
b7cc5c4
Fix `search_is_some` suggests wrongly inside macro (#15135)
blyxyas Jul 29, 2025
c7dd98c
Do not autofix comments containing bare CR (#15175)
blyxyas Jul 29, 2025
642bec7
Optimize some usages of double unary operators in suggestions
samueltardieu Jul 28, 2025
e8db4aa
Fix min_ident_chars: add trait/impl awareness
t-webber Jul 14, 2025
c578762
Output lintcheck summary HTML markdown in order
samueltardieu Jul 30, 2025
64276e6
chore: fix some minor issues in comments
houpo-bob Jul 30, 2025
436efbb
Fix `min_ident_chars`: ignore on trait impl. (#15275)
samueltardieu Jul 30, 2025
18e8ac3
chore: fix some minor issues in comments (#15372)
samueltardieu Jul 30, 2025
445d419
Fix `iter_on_single_items` FP on function pointers and let stmts (#15…
blyxyas Jul 30, 2025
3c54672
Optimize some usages of `!!` and `--` in suggestions (#15366)
Jarcho Jul 30, 2025
7d662ee
Distinguish appending and replacing self ty in predicates
compiler-errors Jul 30, 2025
e295a7d
Simplify boolean expression in `manual_assert`
samueltardieu Jul 28, 2025
c78d589
Remove `TyCtxt::get_attrs_unchecked`.
nnethercote Jul 30, 2025
d7b7e23
Extend `is_case_difference` to handle digit-letter confusables
xizheyin Jul 30, 2025
618a90d
Deduplicate `IntTy`/`UintTy`/`FloatTy`.
nnethercote Jul 31, 2025
05e3a7a
remove rustc_attr_data_structures
jdonszelmann Jul 31, 2025
fab7eab
Output lintcheck summary HTML markdown in order (#15371)
blyxyas Jul 31, 2025
d6a9497
Rollup merge of #144712 - nnethercote:dedup-num-types, r=fmease
jdonszelmann Jul 31, 2025
0f810ac
Rollup merge of #144726 - jdonszelmann:move-attr-data-structures, r=lcnr
jdonszelmann Jul 31, 2025
9f7a8f8
Changelog for Clippy 1.89
alex-semenyuk Jul 30, 2025
1b39c35
Rollup merge of #144691 - xizheyin:suggest-confuse, r=estebank
jhpratt Aug 1, 2025
eea4d6d
`{flat_,}map_identity`: recognize (tuple) struct de- and restructuring
ada4a Jul 12, 2025
94b7035
Do not specialize for `if_chain` any longer (#15362)
dswij Aug 1, 2025
01d960f
Optimize broken_links by 99.77%
blyxyas Aug 1, 2025
cde155d
Optimize broken_links by 99.77% (#15385)
samueltardieu Aug 2, 2025
0f98da7
fix: let_with_type_underscore don't eat closing paren in let (i): _ = 0;
ada4a Aug 2, 2025
e42586d
fix: `let_with_type_underscore` don't eat closing paren in `let (i): …
samueltardieu Aug 2, 2025
ffcd129
`{flat_,}map_identity`: recognize (tuple) struct de- and restructurin…
y21 Aug 2, 2025
e8185ec
Extend `implicit_clone` to handle `to_string` calls (#14177)
y21 Aug 2, 2025
b8c16e4
fix: `option_if_let_else` keep deref op if the inner expr is a raw po…
zihan0822 Aug 2, 2025
8f6b43d
fix: `option_if_let_else` don't suggest argless function for Result::…
zihan0822 Aug 2, 2025
fa09b86
Simplify boolean expression in `manual_assert` (#15368)
Jarcho Aug 3, 2025
88bcf1c
fix option-if-let-else lint (#15394)
Jarcho Aug 3, 2025
02ebef4
don't allocate a `Vec` in an `Iterator::chain`
ada4a Aug 3, 2025
3b907ea
use parens for clearer formatting
ada4a Aug 3, 2025
2d8d45e
use `?` for brevity
ada4a Aug 3, 2025
151a045
clean-up `SourceFileRange::as_str` (#15401)
llogiq Aug 3, 2025
470ee4f
don't allocate a `Vec` in an `Iterator::chain` (#15400)
llogiq Aug 3, 2025
68ef9c4
Task priority
alex-semenyuk Aug 2, 2025
1fc5e81
clean-up `semicolon_inside_block`
ada4a Aug 2, 2025
ed363ac
Rollup merge of #144694 - compiler-errors:with-self-ty, r=SparrowLii
Zalathar Aug 4, 2025
2b9fb32
clean-up `semicolon_inside_block` (#15390)
samueltardieu Aug 4, 2025
7a17931
Changelog for Clippy 1.89 🌽 (#15375)
flip1995 Aug 4, 2025
0708b6a
Fix not showing deprecated lints
alex-semenyuk Aug 4, 2025
048e8f2
Fix not showing deprecated lints (#15407)
Alexendoo Aug 4, 2025
5b22c0c
Remove rogue comma from infallible_try_from lint message
Fayti1703 Aug 4, 2025
d6cf7b9
Remove rogue comma from infallible_try_from lint message (#15409)
samueltardieu Aug 4, 2025
826e514
Issues priority (#15393)
blyxyas Aug 4, 2025
264bc97
Split `possible_missing_else` from `suspicious_else_formatting` (#15317)
blyxyas Aug 4, 2025
6c7fa3b
Do not lint for `wildcard_imports` in external macro
samueltardieu Aug 5, 2025
0ea413f
Generate lint count in template
Alexendoo Aug 5, 2025
b98252f
Generate lint count in template (#15414)
samueltardieu Aug 5, 2025
cdee4f8
Move `cognitive_complexity` lint from `nursery` to `restriction`
samueltardieu Aug 5, 2025
4d1962c
Move `cognitive_complexity` lint from `nursery` to `restriction` (#15…
flip1995 Aug 5, 2025
6249f33
fix: unnecessary_sort_by lint method consistency in message and sugge…
Huterenok Aug 5, 2025
8396d73
Fix `unnecessary_sort_by` lint method consistency in message and sugg…
samueltardieu Aug 5, 2025
03ae8b0
Do not lint for `wildcard_imports` in external macro (#15413)
blyxyas Aug 5, 2025
7673826
expand the issue template for new lints (#15336)
flip1995 Aug 6, 2025
04e794a
Fix CSS indent
GuillaumeGomez Jul 11, 2025
102e39f
Remove CSS bootstrap dependency
GuillaumeGomez Jul 11, 2025
d98d7c0
Fix suggestion for `collapsible_if` and `collapsible_else_if` when th…
llogiq Aug 6, 2025
26911aa
Optimize `incompatible_msrv` lint
samueltardieu Aug 6, 2025
925710d
Remove CSS bootstrap dependency (#15251)
flip1995 Aug 6, 2025
a4d4321
Optimize `incompatible_msrv` lint (#15422)
blyxyas Aug 6, 2025
8602faa
Optimize `needless_bool` lint
samueltardieu Aug 6, 2025
4cb43f4
Optimize `needless_bool` lint (#15423)
blyxyas Aug 6, 2025
a5af84c
Fix "comparision" typo in new lint template
y21 Aug 7, 2025
faba846
Fix typo in lint issue template (#15427)
samueltardieu Aug 7, 2025
f2b7e9f
Merge remote-tracking branch 'upstream/master' into rustup
flip1995 Aug 7, 2025
2893dc8
Bump nightly version -> 2025-08-07
flip1995 Aug 7, 2025
d5f9f75
Bump Clippy version -> 0.1.91
flip1995 Aug 7, 2025
334fb90
Rustup (#15431)
flip1995 Aug 7, 2025
d938543
Merge commit '334fb906aef13d20050987b13448f37391bb97a2' into clippy-s…
flip1995 Aug 7, 2025
770e6f1
Update Cargo.lock
flip1995 Aug 7, 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 @@ -568,7 +568,7 @@ checksum = "b94f61472cee1439c0b966b47e3aca9ae07e45d070759512cd390ea2bebc6675"

[[package]]
name = "clippy"
version = "0.1.90"
version = "0.1.91"
dependencies = [
"anstream",
"askama",
Expand All @@ -595,7 +595,7 @@ dependencies = [

[[package]]
name = "clippy_config"
version = "0.1.90"
version = "0.1.91"
dependencies = [
"clippy_utils",
"itertools",
Expand All @@ -618,7 +618,7 @@ dependencies = [

[[package]]
name = "clippy_lints"
version = "0.1.90"
version = "0.1.91"
dependencies = [
"arrayvec",
"cargo_metadata 0.18.1",
Expand Down Expand Up @@ -649,7 +649,7 @@ dependencies = [

[[package]]
name = "clippy_utils"
version = "0.1.90"
version = "0.1.91"
dependencies = [
"arrayvec",
"itertools",
Expand Down Expand Up @@ -1051,7 +1051,7 @@ dependencies = [

[[package]]
name = "declare_clippy_lint"
version = "0.1.90"
version = "0.1.91"

[[package]]
name = "derive-where"
Expand Down
21 changes: 21 additions & 0 deletions src/tools/clippy/.github/ISSUE_TEMPLATE/new_lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,24 @@ body:
```
validations:
required: true
- type: textarea
id: comparison
attributes:
label: Comparison with existing lints
description: |
What makes this lint different from any existing lints that are similar, and how are those differences useful?
You can [use this playground template to see what existing lints are triggered by the bad code][playground]
(make sure to use "Tools > Clippy" and not "Build").
You can also look through the list of [rustc's allowed-by-default lints][allowed-by-default],
as those won't show up in the playground above.
[allowed-by-default]: https://doc.rust-lang.org/rustc/lints/listing/allowed-by-default.html
[playground]: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2024&code=%23%21%5Bwarn%28clippy%3A%3Apedantic%29%5D%0A%23%21%5Bwarn%28clippy%3A%3Anursery%29%5D%0A%23%21%5Bwarn%28clippy%3A%3Arestriction%29%5D%0A%23%21%5Bwarn%28clippy%3A%3Aall%29%5D%0A%23%21%5Ballow%28clippy%3A%3Ablanket_clippy_restriction_lints%2C+reason+%3D+%22testing+to+see+if+any+restriction+lints+match+given+code%22%29%5D%0A%0A%2F%2F%21+Template+that+can+be+used+to+see+what+clippy+lints+a+given+piece+of+code+would+trigger
placeholder: Unlike `clippy::...`, the proposed lint would...
- type: textarea
id: context
attributes:
label: Additional Context
description: Any additional context that you believe may be relevant.
6 changes: 3 additions & 3 deletions src/tools/clippy/.github/driver.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ unset CARGO_MANIFEST_DIR

# Run a lint and make sure it produces the expected output. It's also expected to exit with code 1
# FIXME: How to match the clippy invocation in compile-test.rs?
./target/debug/clippy-driver -Dwarnings -Aunused -Zui-testing --emit metadata --crate-type bin tests/ui/string_to_string.rs 2>string_to_string.stderr && exit 1
sed -e "/= help: for/d" string_to_string.stderr > normalized.stderr
diff -u normalized.stderr tests/ui/string_to_string.stderr
./target/debug/clippy-driver -Dwarnings -Aunused -Zui-testing --emit metadata --crate-type bin tests/ui/char_lit_as_u8.rs 2>char_lit_as_u8.stderr && exit 1
sed -e "/= help: for/d" char_lit_as_u8.stderr > normalized.stderr
diff -u normalized.stderr tests/ui/char_lit_as_u8.stderr

# make sure "clippy-driver --rustc --arg" and "rustc --arg" behave the same
SYSROOT=$(rustc --print sysroot)
Expand Down
101 changes: 100 additions & 1 deletion src/tools/clippy/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,105 @@ document.

## Unreleased / Beta / In Rust Nightly

[03a5b6b9...master](https://github.com/rust-lang/rust-clippy/compare/03a5b6b9...master)
[4ef75291...master](https://github.com/rust-lang/rust-clippy/compare/4ef75291...master)

## Rust 1.89

Current stable, released 2025-08-07

[View all 137 merged pull requests](https://github.com/rust-lang/rust-clippy/pulls?q=merged%3A2025-05-01T16%3A52%3A57Z..2025-06-13T08%3A33%3A27Z+base%3Amaster)

### New Lints

* Added [`coerce_container_to_any`] to `nursery` [#14812](https://github.com/rust-lang/rust-clippy/pull/14812)
* Added [`ip_constant`] to `pedantic` [#14878](https://github.com/rust-lang/rust-clippy/pull/14878)
* Added [`infallible_try_from`] to `suspicious` [#14813](https://github.com/rust-lang/rust-clippy/pull/14813)
* Added [`doc_suspicious_footnotes`] to `suspicious` [#14708](https://github.com/rust-lang/rust-clippy/pull/14708)
* Added [`pointer_format`] to `restriction` [#14792](https://github.com/rust-lang/rust-clippy/pull/14792)
* Added [`useless_concat`] to `complexity` [#13829](https://github.com/rust-lang/rust-clippy/pull/13829)
* Added [`cloned_ref_to_slice_refs`] to `perf` [#14284](https://github.com/rust-lang/rust-clippy/pull/14284)
* Added [`confusing_method_to_numeric_cast`] to `suspicious` [#13979](https://github.com/rust-lang/rust-clippy/pull/13979)

### Moves and Deprecations

* Removed superseded lints: `transmute_float_to_int`, `transmute_int_to_char`,
`transmute_int_to_float`, `transmute_num_to_bytes` (now in rustc)
[#14703](https://github.com/rust-lang/rust-clippy/pull/14703)

### Enhancements

* [`module_name_repetitions`] added `allow_exact_repetitions` configuration option
[#14261](https://github.com/rust-lang/rust-clippy/pull/14261)
* [`missing_docs_in_private_items`] added `allow_unused` config for underscored fields
[#14453](https://github.com/rust-lang/rust-clippy/pull/14453)
* [`unnecessary_unwrap`] fixed being emitted twice in closure
[#14763](https://github.com/rust-lang/rust-clippy/pull/14763)
* [`needless_return`] lint span no longer wraps to previous line
[#14790](https://github.com/rust-lang/rust-clippy/pull/14790)
* [`trivial-copy-size-limit`] now defaults to `target_pointer_width`
[#13319](https://github.com/rust-lang/rust-clippy/pull/13319)
* [`integer_division`] fixed false negative for NonZero denominators
[#14664](https://github.com/rust-lang/rust-clippy/pull/14664)
* [`arbitrary_source_item_ordering`] no longer lints inside items with `#[repr]` attribute
[#14610](https://github.com/rust-lang/rust-clippy/pull/14610)
* [`excessive_precision`] no longer triggers on exponent with leading zeros
[#14824](https://github.com/rust-lang/rust-clippy/pull/14824)
* [`to_digit_is_some`] no longer lints in const contexts when MSRV is below 1.87
[#14771](https://github.com/rust-lang/rust-clippy/pull/14771)

### False Positive Fixes

* [`std_instead_of_core`] fixed FP when part of the `use` cannot be replaced
[#15016](https://github.com/rust-lang/rust-clippy/pull/15016)
* [`unused_unit`] fixed FP for `Fn` bounds
[#14962](https://github.com/rust-lang/rust-clippy/pull/14962)
* [`unnecessary_debug_formatting`] fixed FP inside `Debug` impl
[#14955](https://github.com/rust-lang/rust-clippy/pull/14955)
* [`assign_op_pattern`] fixed FP on unstable const trait
[#14886](https://github.com/rust-lang/rust-clippy/pull/14886)
* [`useless_conversion`] fixed FP when using `.into_iter().any()`
[#14800](https://github.com/rust-lang/rust-clippy/pull/14800)
* [`collapsible_if`] fixed FP on block stmt before expr
[#14730](https://github.com/rust-lang/rust-clippy/pull/14730)
* [`manual_unwrap_or_default`] fixed FP on ref binding
[#14731](https://github.com/rust-lang/rust-clippy/pull/14731)
* [`unused_async`] fixed FP on default impl
[#14720](https://github.com/rust-lang/rust-clippy/pull/14720)
* [`manual_slice_fill`] fixed FP on `IndexMut` overload
[#14719](https://github.com/rust-lang/rust-clippy/pull/14719)
* [`unnecessary_to_owned`] fixed FP when map key is a reference
[#14834](https://github.com/rust-lang/rust-clippy/pull/14834)

### ICE Fixes

* [`mutable_key_type`] fixed ICE when infinitely associated generic types are used
[#14965](https://github.com/rust-lang/rust-clippy/pull/14965)
* [`zero_sized_map_values`] fixed ICE while computing type layout
[#14837](https://github.com/rust-lang/rust-clippy/pull/14837)
* [`useless_asref`] fixed ICE on trait method
[#14830](https://github.com/rust-lang/rust-clippy/pull/14830)
* [`manual_slice_size_calculation`] fixed ICE in suggestion and triggers in `const` context
[#14804](https://github.com/rust-lang/rust-clippy/pull/14804)
* [`missing_const_for_fn`]: fix ICE with some compilation options
[#14776](https://github.com/rust-lang/rust-clippy/pull/14776)

### Documentation Improvements

* [`manual_contains`] improved documentation wording
[#14917](https://github.com/rust-lang/rust-clippy/pull/14917)

### Performance improvements

* [`strlen_on_c_strings`] optimized by 99.75% (31M → 76k instructions)
[#15043](https://github.com/rust-lang/rust-clippy/pull/15043)
* Reduced documentation lints execution time by 85% (7.5% → 1% of total runtime)
[#14870](https://github.com/rust-lang/rust-clippy/pull/14870)
* [`unit_return_expecting_ord`] optimized to reduce binder instantiation from 95k to 10k calls
[#14905](https://github.com/rust-lang/rust-clippy/pull/14905)
* [`doc_markdown`] optimized by 50%
[#14693](https://github.com/rust-lang/rust-clippy/pull/14693)
* Refactor and speed up `cargo dev fmt`
[#14638](https://github.com/rust-lang/rust-clippy/pull/14638)

## Rust 1.88

Expand Down Expand Up @@ -6260,6 +6358,7 @@ Released 2018-09-13
[`pointers_in_nomem_asm_block`]: https://rust-lang.github.io/rust-clippy/master/index.html#pointers_in_nomem_asm_block
[`positional_named_format_parameters`]: https://rust-lang.github.io/rust-clippy/master/index.html#positional_named_format_parameters
[`possible_missing_comma`]: https://rust-lang.github.io/rust-clippy/master/index.html#possible_missing_comma
[`possible_missing_else`]: https://rust-lang.github.io/rust-clippy/master/index.html#possible_missing_else
[`precedence`]: https://rust-lang.github.io/rust-clippy/master/index.html#precedence
[`precedence_bits`]: https://rust-lang.github.io/rust-clippy/master/index.html#precedence_bits
[`print_in_format_impl`]: https://rust-lang.github.io/rust-clippy/master/index.html#print_in_format_impl
Expand Down
44 changes: 26 additions & 18 deletions src/tools/clippy/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,26 +199,34 @@ currently. Between writing new lints, fixing issues, reviewing pull requests and
responding to issues there may not always be enough time to stay on top of it
all.

Our highest priority is fixing [ICEs][I-ICE] and [bugs][C-bug], for example
an ICE in a popular crate that many other crates depend on. We don't
want Clippy to crash on your code and we want it to be as reliable as the
suggestions from Rust compiler errors.

We have prioritization labels and a sync-blocker label, which are described below.
- [P-low][p-low]: Requires attention (fix/response/evaluation) by a team member but isn't urgent.
- [P-medium][p-medium]: Should be addressed by a team member until the next sync.
- [P-high][p-high]: Should be immediately addressed and will require an out-of-cycle sync or a backport.
- [L-sync-blocker][l-sync-blocker]: An issue that "blocks" a sync.
Or rather: before the sync this should be addressed,
e.g. by removing a lint again, so it doesn't hit beta/stable.
To find things to fix, go to the [tracking issue][tracking_issue], find an issue that you like,
and claim it with `@rustbot claim`.

As a general metric and always taking into account your skill and knowledge level, you can use this guide:

- 🟥 [ICEs][search_ice], these are compiler errors that causes Clippy to panic and crash. Usually involves high-level
debugging, sometimes interacting directly with the upstream compiler. Difficult to fix but a great challenge that
improves a lot developer workflows!

- 🟧 [Suggestion causes bug][sugg_causes_bug], Clippy suggested code that changed logic in some silent way.
Unacceptable, as this may have disastrous consequences. Easier to fix than ICEs

- 🟨 [Suggestion causes error][sugg_causes_error], Clippy suggested code snippet that caused a compiler error
when applied. We need to make sure that Clippy doesn't suggest using a variable twice at the same time or similar
easy-to-happen occurrences.

- 🟩 [False positives][false_positive], a lint should not have fired, the easiest of them all, as this is "just"
identifying the root of a false positive and making an exception for those cases.

Note that false negatives do not have priority unless the case is very clear, as they are a feature-request in a
trench coat.

[triage]: https://forge.rust-lang.org/release/triage-procedure.html
[I-ICE]: https://github.com/rust-lang/rust-clippy/labels/I-ICE
[C-bug]: https://github.com/rust-lang/rust-clippy/labels/C-bug
[p-low]: https://github.com/rust-lang/rust-clippy/labels/P-low
[p-medium]: https://github.com/rust-lang/rust-clippy/labels/P-medium
[p-high]: https://github.com/rust-lang/rust-clippy/labels/P-high
[l-sync-blocker]: https://github.com/rust-lang/rust-clippy/labels/L-sync-blocker
[search_ice]: https://github.com/rust-lang/rust-clippy/issues?q=sort%3Aupdated-desc+state%3Aopen+label%3A%22I-ICE%22
[sugg_causes_bug]: https://github.com/rust-lang/rust-clippy/issues?q=sort%3Aupdated-desc%20state%3Aopen%20label%3AI-suggestion-causes-bug
[sugg_causes_error]: https://github.com/rust-lang/rust-clippy/issues?q=sort%3Aupdated-desc%20state%3Aopen%20label%3AI-suggestion-causes-error%20
[false_positive]: https://github.com/rust-lang/rust-clippy/issues?q=sort%3Aupdated-desc%20state%3Aopen%20label%3AI-false-positive
[tracking_issue]: https://github.com/rust-lang/rust-clippy/issues/15086

## Contributions

Expand Down
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.90"
version = "0.1.91"
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: 1 addition & 1 deletion src/tools/clippy/book/src/lint_configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ default configuration of Clippy. By default, any configuration will replace the
* `doc-valid-idents = ["ClipPy"]` would replace the default list with `["ClipPy"]`.
* `doc-valid-idents = ["ClipPy", ".."]` would append `ClipPy` to the default list.

**Default Value:** `["KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "MHz", "GHz", "THz", "AccessKit", "CoAP", "CoreFoundation", "CoreGraphics", "CoreText", "DevOps", "Direct2D", "Direct3D", "DirectWrite", "DirectX", "ECMAScript", "GPLv2", "GPLv3", "GitHub", "GitLab", "IPv4", "IPv6", "ClojureScript", "CoffeeScript", "JavaScript", "PostScript", "PureScript", "TypeScript", "WebAssembly", "NaN", "NaNs", "OAuth", "GraphQL", "OCaml", "OpenAL", "OpenDNS", "OpenGL", "OpenMP", "OpenSSH", "OpenSSL", "OpenStreetMap", "OpenTelemetry", "OpenType", "WebGL", "WebGL2", "WebGPU", "WebRTC", "WebSocket", "WebTransport", "WebP", "OpenExr", "YCbCr", "sRGB", "TensorFlow", "TrueType", "iOS", "macOS", "FreeBSD", "NetBSD", "OpenBSD", "TeX", "LaTeX", "BibTeX", "BibLaTeX", "MinGW", "CamelCase"]`
**Default Value:** `["KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "MHz", "GHz", "THz", "AccessKit", "CoAP", "CoreFoundation", "CoreGraphics", "CoreText", "DevOps", "Direct2D", "Direct3D", "DirectWrite", "DirectX", "ECMAScript", "GPLv2", "GPLv3", "GitHub", "GitLab", "IPv4", "IPv6", "ClojureScript", "CoffeeScript", "JavaScript", "PostScript", "PureScript", "TypeScript", "WebAssembly", "NaN", "NaNs", "OAuth", "GraphQL", "OCaml", "OpenAL", "OpenDNS", "OpenGL", "OpenMP", "OpenSSH", "OpenSSL", "OpenStreetMap", "OpenTelemetry", "OpenType", "WebGL", "WebGL2", "WebGPU", "WebRTC", "WebSocket", "WebTransport", "WebP", "OpenExr", "YCbCr", "sRGB", "TensorFlow", "TrueType", "iOS", "macOS", "FreeBSD", "NetBSD", "OpenBSD", "NixOS", "TeX", "LaTeX", "BibTeX", "BibLaTeX", "MinGW", "CamelCase"]`

---
**Affected lints:**
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.90"
version = "0.1.91"
edition = "2024"
publish = false

Expand Down
2 changes: 1 addition & 1 deletion src/tools/clippy/clippy_config/src/conf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const DEFAULT_DOC_VALID_IDENTS: &[&str] = &[
"WebP", "OpenExr", "YCbCr", "sRGB",
"TensorFlow",
"TrueType",
"iOS", "macOS", "FreeBSD", "NetBSD", "OpenBSD",
"iOS", "macOS", "FreeBSD", "NetBSD", "OpenBSD", "NixOS",
"TeX", "LaTeX", "BibTeX", "BibLaTeX",
"MinGW",
"CamelCase",
Expand Down
2 changes: 1 addition & 1 deletion src/tools/clippy/clippy_lints/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "clippy_lints"
version = "0.1.90"
version = "0.1.91"
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
3 changes: 1 addition & 2 deletions src/tools/clippy/clippy_lints/src/approx_const.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ use clippy_config::Conf;
use clippy_utils::diagnostics::span_lint_and_help;
use clippy_utils::msrvs::{self, Msrv};
use rustc_ast::ast::{FloatTy, LitFloatType, LitKind};
use rustc_hir::RustcVersion;
use rustc_hir::{HirId, Lit};
use rustc_hir::{HirId, Lit, RustcVersion};
use rustc_lint::{LateContext, LateLintPass};
use rustc_session::impl_lint_pass;
use rustc_span::{Span, symbol};
Expand Down
44 changes: 26 additions & 18 deletions src/tools/clippy/clippy_lints/src/attrs/duplicated_attributes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use super::DUPLICATED_ATTRIBUTES;
use clippy_utils::diagnostics::span_lint_and_then;
use itertools::Itertools;
use rustc_ast::{Attribute, MetaItem};
use rustc_ast_pretty::pprust::path_to_string;
use rustc_data_structures::fx::FxHashMap;
use rustc_lint::EarlyContext;
use rustc_span::{Span, Symbol, sym};
Expand Down Expand Up @@ -35,39 +36,46 @@ fn check_duplicated_attr(
if attr.span.from_expansion() {
return;
}
let Some(ident) = attr.ident() else { return };
let name = ident.name;
if name == sym::doc || name == sym::cfg_attr_trace || name == sym::rustc_on_unimplemented || name == sym::reason {
// FIXME: Would be nice to handle `cfg_attr` as well. Only problem is to check that cfg
// conditions are the same.
// `#[rustc_on_unimplemented]` contains duplicated subattributes, that's expected.
return;
}
if let Some(direct_parent) = parent.last()
&& *direct_parent == sym::cfg_trace
&& [sym::all, sym::not, sym::any].contains(&name)
{
// FIXME: We don't correctly check `cfg`s for now, so if it's more complex than just a one
// level `cfg`, we leave.
return;
let attr_path = if let Some(ident) = attr.ident() {
ident.name
} else {
Symbol::intern(&path_to_string(&attr.path))
};
if let Some(ident) = attr.ident() {
let name = ident.name;
if name == sym::doc || name == sym::cfg_attr_trace || name == sym::rustc_on_unimplemented || name == sym::reason
{
// FIXME: Would be nice to handle `cfg_attr` as well. Only problem is to check that cfg
// conditions are the same.
// `#[rustc_on_unimplemented]` contains duplicated subattributes, that's expected.
return;
}
if let Some(direct_parent) = parent.last()
&& *direct_parent == sym::cfg_trace
&& [sym::all, sym::not, sym::any].contains(&name)
{
// FIXME: We don't correctly check `cfg`s for now, so if it's more complex than just a one
// level `cfg`, we leave.
return;
}
}
if let Some(value) = attr.value_str() {
emit_if_duplicated(
cx,
attr,
attr_paths,
format!("{}:{name}={value}", parent.iter().join(":")),
format!("{}:{attr_path}={value}", parent.iter().join(":")),
);
} else if let Some(sub_attrs) = attr.meta_item_list() {
parent.push(name);
parent.push(attr_path);
for sub_attr in sub_attrs {
if let Some(meta) = sub_attr.meta_item() {
check_duplicated_attr(cx, meta, attr_paths, parent);
}
}
parent.pop();
} else {
emit_if_duplicated(cx, attr, attr_paths, format!("{}:{name}", parent.iter().join(":")));
emit_if_duplicated(cx, attr, attr_paths, format!("{}:{attr_path}", parent.iter().join(":")));
}
}

Expand Down
3 changes: 1 addition & 2 deletions src/tools/clippy/clippy_lints/src/attrs/inline_always.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
use super::INLINE_ALWAYS;
use clippy_utils::diagnostics::span_lint;
use rustc_hir::attrs::{AttributeKind, InlineAttr};
use rustc_hir::find_attr;
use rustc_hir::Attribute;
use rustc_hir::{Attribute, find_attr};
use rustc_lint::LateContext;
use rustc_span::Span;
use rustc_span::symbol::Symbol;
Expand Down
3 changes: 1 addition & 2 deletions src/tools/clippy/clippy_lints/src/attrs/repr_attributes.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use rustc_hir::attrs::{AttributeKind, ReprAttr};
use rustc_hir::find_attr;
use rustc_hir::Attribute;
use rustc_hir::{Attribute, find_attr};
use rustc_lint::LateContext;
use rustc_span::Span;

Expand Down
Loading
Loading