Commit graph

10719 commits

Author SHA1 Message Date
Ada Alakbarova
757bad7206
fix equatable_if_let: FP in const context 2025-11-14 22:33:23 +01:00
llogiq
540e2f4a2a
feat(ok_expect): add autofix (#15867)
changelog: [`ok_expect`]: add autofix
2025-11-14 12:12:31 +00:00
llogiq
663ef9b31b
fix(rc_buffer): don't touch the path to Rc/Arc in the suggestion (#15803)
Fixes https://github.com/rust-lang/rust-clippy/issues/15802

changelog: [`rc_buffer`]: don't touch the path to `Rc`/`Arc` in the
suggestion
2025-11-14 09:52:59 +00:00
Timo
0ac66461bb
refactor(needless_arbitrary_self_type): give suggestions with finer diffs (#16005)
changelog: [`needless_arbitrary_self_type`]: give suggestions with finer
diffs
2025-11-12 20:49:39 +00:00
Philipp Krones
da2a220a2e
incompatible_msrv: Don't check the contents of any std macro. (#16083)
cc rust-lang/rust#148190 @flip1995 @RalfJung

This is a bit of a hack in that it hardcodes the list of crates with
stability attributes. This shouldn't be a big deal since that isn't a
set that changes very frequently and an internal lint could detect when
that happens.

The `fixme`s added aren't new issues and shouldn't get in the way of
unblocking the upstream issue.

changelog: none
2025-11-12 17:22:17 +00:00
Jason Newcomb
a537e86e7f incompatible_msrv: Don't check the contents of any std macro. 2025-11-12 12:01:16 -05:00
Samuel Tardieu
d599529223
Fix single_range_in_vec_init FP for explicit Range (#16043)
Closes rust-lang/rust-clippy#16042
Closes rust-lang/rust-clippy#16044

changelog: [`single_range_in_vec_init`] fix FP for explicit `Range`
2025-11-11 10:28:46 +00:00
Linshu Yang
e1ac7da6a1 fix: useless_let_if_seq wrongly unmangled macros 2025-11-10 20:01:15 +00:00
Linshu Yang
8a1dde1449 fix: useless_let_if_seq FN when if is in the last expr of block 2025-11-10 19:30:50 +00:00
Linshu Yang
6834ab61b1 fix: single_range_in_vec_init wrongly unmangles macros 2025-11-10 17:25:01 +00:00
Linshu Yang
c8885d5313 fix: single_range_in_vec_init FP for explicit Range 2025-11-10 17:25:01 +00:00
Ada Alakbarova
a4a88ea592
refactor(needless_arbitrary_self_type): give suggestions with finer diffs 2025-11-08 19:48:32 +01:00
Jason Newcomb
d154da9773
chore(unnecessary_mut_passed): show the intention not to lint &raw references (#16049)
Supersedes https://github.com/rust-lang/rust-clippy/pull/15962

changelog: none

r? @Jarcho
2025-11-08 14:24:20 +00:00
Ada Alakbarova
b59b2fdddb
chore(unnecessary_mut_passed): show the intention not to lint &raw references 2025-11-08 10:15:17 +01:00
Ada Alakbarova
21ddc50eec
chore(unnecessary_map_on_constructor): clean-up
- reduce indentation
- print constructor/method name in backticks
2025-11-07 22:14:03 +01:00
llogiq
8ed05abef3
Fix missing_asserts_for_indexing changes assert_eq to assert (#16040)
Closes rust-lang/rust-clippy#16026

changelog: [`missing_asserts_for_indexing`] fix wrongly changing
`assert_eq` to `assert`
2025-11-06 22:28:32 +00:00
Jason Newcomb
c004be44c8
Fix nonminimal_bool wrongly unmangled terms (#16017)
Closes rust-lang/rust-clippy#16014

changelog: [`nonminimal_bool`] fix wrongly unmangled terms
2025-11-06 18:26:11 +00:00
llogiq
36324e8e9c
Don't flag cfg(test) as multiple inherent impl (#16041)
changelog: [`multiple_inherent_impl`]: Don't flag cfg(test) impls as
repeats

fixes rust-lang/rust-clippy#13040
2025-11-06 18:25:48 +00:00
Alex Macleod
52a39998fa
Fix missing_inline_in_public_items fail to fulfill expect in --test build (#15320)
Closes rust-lang/rust-clippy#13394

changelog: [`missing_inline_in_public_items`] fix failure to fulfill
`expect` in `--test` build
2025-11-06 16:49:21 +00:00
Nick Drozd
8539de9ccf Don't flag cfg(test) as multiple inherent impl 2025-11-06 09:49:10 -06:00
yanglsh
a86dd63818 Make missing_inline_in_public_items warn on executables 2025-11-06 15:29:30 +00:00
Linshu Yang
0ab135f9d0 fix: missing_asserts_for_indexing changes assert_eq to assert 2025-11-06 15:12:08 +00:00
llogiq
c95d95bf95
Fix match_single_binding suggests wrongly inside tuple (#15539)
Closes rust-lang/rust-clippy#15537
Closes rust-lang/rust-clippy#15840

changelog: [`match_single_binding`] fix wrong suggestions inside tuple
2025-11-06 11:01:03 +00:00
Linshu Yang
c100a0808b fix: nonminimal_bool wrongly unmangled terms 2025-11-05 16:14:59 +00:00
Samuel Tardieu
4eac58a0b0
Consider type conversion that won't overflow (#15950)
Fix rust-lang/rust-clippy#15943

```rust
pub fn from_days(days: u8) -> Duration {
    Duration::from_secs(86400 * u64::from(days))
}
```

An initial foundation that can be used for future improvements. It is
been a while since I touched Clippy so feel free to indicate better
designs if applicable.

Looks like https://github.com/rust-lang/rust-clippy/pull/15342 will help
but it is unclear when it will be finished. This PR provides a partial
solution for the current time.

changelog: [`arithmetic_side_effects`]: Consider type conversion that
won't overflow
2025-11-05 08:07:35 +00:00
Samuel Tardieu
a456519ce0
fix(let_and_return): disallow _any_ text between let and return (#16006)
Fixes https://github.com/rust-lang/rust-clippy/issues/15987

changelog: [`let_and_return`]: disallow _any_ text between let and
return
2025-11-02 09:28:39 +00:00
Samuel Tardieu
e121ab877e
Fix replace_box FP when the box is moved (#15984)
Closes rust-lang/rust-clippy#15968

changelog: [`replace_box`] fix FP when the box is moved

r? samueltardieu As you wish

<!-- TRIAGEBOT_START -->

<!-- TRIAGEBOT_SUMMARY_START -->

### Summary Notes

-
[Beta-nomination](https://github.com/rust-lang/rust-clippy/pull/15984#issuecomment-3469127087)
by [samueltardieu](https://github.com/samueltardieu)

*Managed by `@rustbot`—see
[help](https://forge.rust-lang.org/triagebot/note.html) for details*

<!-- TRIAGEBOT_SUMMARY_END -->
<!-- TRIAGEBOT_END -->
2025-11-02 09:12:28 +00:00
Linshu Yang
098ded3160 fix: replace_box FP when the box is moved 2025-11-02 03:23:16 +00:00
Timo
31d8210a53
unused_enumerate_index: move to loops lint pass (#15279)
Needed to split the lint crate.

Both the method and loop versions of the lint should also behave the
same now.

changelog: None
2025-11-01 19:39:44 +00:00
Ada Alakbarova
6bc8d214b4
fix(let_and_return): disallow _any_ text between let and return 2025-11-01 18:01:28 +01:00
Ada Alakbarova
e7b4ae869e
clean-up 2025-10-31 22:20:53 +01:00
Jason Newcomb
e6298692a5
extend needless_collect (#14361)
changelog: [`needless_collect`]: extend needless_collect to lint more
cases

Fix #14350
2025-10-31 19:12:13 +00:00
Alex Macleod
c23eed6ddc
refactor(write): split each lint into its own module (#15857)
changelog: none
2025-10-31 19:11:42 +00:00
Philipp Krones
f64e401f74
Merge remote-tracking branch 'upstream/master' into rustup 2025-10-31 18:58:07 +01:00
Ada Alakbarova
938dd5f404
misc: test cases with escaping are mostly autofixable now 2025-10-31 17:40:12 +01:00
Jason Newcomb
e415911f49
fix(use_debug): don't get confused by nested Debug impls (#15946)
Fixes https://github.com/rust-lang/rust-clippy/issues/15942

changelog: [`use_debug`]: don't get confused by nested `Debug` impls
2025-10-31 08:10:46 +00:00
Jason Newcomb
bcc40ce3b9
fix(double_parens): don't lint in proc-macros (#15939)
Fixes https://github.com/rust-lang/rust-clippy/issues/15852

changelog: [`double_parens`]: don't lint in proc-macros
2025-10-31 08:09:28 +00:00
dswij
5e7ce90dd8
Improve doc comment code language tag parsing, don't use a full parser (#15967)
Now only tokenizes the contents of code blocks instead of spawning a
thread for a full parser

The language tag handling now correctly picks up things like `rust,
ignore`

`no_test` (rust-lang/rust-clippy#10491) is no longer specially handled,
rustdoc considers `rust,no_test` to be a regular test

changelog: [`needless_doctest_main`], [`test_attr_in_doctest`]: now
handles whitespace in language tags
2025-10-30 15:51:36 +00:00
Samuel Tardieu
d05f74e5f7
refactor(integer_division_remainder_used): move to under operators (#15953)
changelog: none
2025-10-29 21:38:40 +00:00
llogiq
5a90737bf0
Add multiple-inherent-impl tests (#15886)
Add tests for https://github.com/rust-lang/rust-clippy/issues/8714 and
https://github.com/rust-lang/rust-clippy/issues/13040.

changelog:none
2025-10-29 18:44:23 +00:00
Ada Alakbarova
c95db073b6
test(while_immutable_condition): call the test file the same as the lint 2025-10-29 19:13:17 +01:00
Philipp Krones
35e55a63f2
manual_unwrap_or(_default): don't lint if not safe to move scrutinee (#15817)
When matched against `Result` with copyable `Ok` variant, uncopyable
scrutinee won't actually be moved. But
`manual_unwrap_or`/`manual_unwrap_or_default` will force it to move,
which can cause problem if scrutinee is used later.

Fixes rust-lang/rust-clippy#15807

changelog: [`manual_unwrap_or`]: don't lint if not safe to move
scrutinee
changelog: [`manual_unwrap_or_default`]: don't lint if not safe to move
scrutinee
2025-10-29 16:10:45 +00:00
Ada Alakbarova
90b34cbc19
put the operators in backticks in the diagnostics 2025-10-29 10:32:44 +01:00
Samuel Tardieu
7012a5dc18
incompatible_msrv: Don't check the const MSRV for uncalled functions (#15795)
fixes rust-lang/rust-clippy#15792

changelog: [`incompatible_msrv`]: Don't check the const MSRV for
uncalled functions
2025-10-29 08:49:18 +00:00
lengyijun
6d7072b5fd extend needless_collect
Fix https://github.com/rust-lang/rust-clippy/issues/14350

Co-authored-by: Timo <30553356+y21@users.noreply.github.com>
2025-10-29 08:06:58 +08:00
Ada Alakbarova
02e4516252
fix(double_parens): don't lint in proc-macros 2025-10-28 14:39:32 +01:00
Jason Newcomb
f144c6cc66
feat(search_is_some): Fix when the closure spans multiple lines (#15902)
Previously the program only fixed the code when the closure supplied to
the method contained only 1 line. This patch removes the restriction.

The code already works. This patch only removes the extra check that
causes the restriction. The test cases that can now be fixed are moved
into the files containing tests cases that can be fixed.

The unnecessary check has survived in the code this way.

- In Dec 2015, patch a6bd2d0622, pull request
rust-lang/rust-clippy#524. The lint was first added. The program did not
support fixing code automatically yet. So the suggested fix was printed
as a part of the diagnostic message. When the original code contained
multiple lines, the suggested fix was omitted in order to keep the
diagnostic message concise.

- In May 2019, patch bd0b75f6c3, pull request
rust-lang/rust-clippy#4049. Logic was added to strip the reference in
the closure when the suggested replacement method required it. Because
the fix was still only printed when the code contained a single line,
the new transformation was only done when the code contained a single
line.

- In Aug 2019, patch 945d4cf69f, pull request
rust-lang/rust-clippy#4454. The lint was updated to fix code
automatically. Because the fixed code had only been printed in the
diagnostic message for a single line, the fix was only added for a
single line.

- In Nov 2021, patch 092fe209a6, pull request
rust-lang/rust-clippy#7463. The logic for transforming the closure was
moved into another file. A comment was added saying that it was only
good for a single line because it had only been used for a single line.

changelog: [`search_is_some`] now fixes code spanning multiple lines
2025-10-28 09:39:01 +00:00
Jason Newcomb
ce6f8bce1f Refactor unused_enumerate_index. 2025-10-28 05:12:35 -04:00
Cameron Steffen
ae9d202f8c Remove QPath::LangItem from ranges 2025-10-27 21:19:38 -05:00
Alex Macleod
0ff3a380e1 Improve doc comment code language tag parsing, don't use a full parser 2025-10-27 22:01:06 +00:00