Commit graph

36 commits

Author SHA1 Message Date
Guillaume Gomez
f666fd6417 Update UI tests 2025-02-15 13:38:16 +01:00
bors
8e60f143d8 Auto merge of #13464 - y21:issue13458, r=flip1995
Don't warn on proc macro generated code in `needless_return`

Fixes #13458
Fixes #13457
Fixes #13467
Fixes #13479
Fixes #13481
Fixes #13526
Fixes #13486

The fix is unfortunately a little more convoluted than just simply adding a `is_from_proc_macro`. That check *does*  fix the issue, however it also introduces a bunch of false negatives in the tests, specifically when the returned expression is in a different syntax context, e.g. `return format!(..)`.

The proc macro check builds up a start and end pattern based on the HIR nodes and compares it to a snippet of the span, however that would currently fail for `return format!(..)` because we would have the patterns `("return", <something inside of the format macro>)`, which doesn't compare equal. So we now return an empty string pattern for when it's in a different syntax context.

"Hide whitespace" helps a bit for reviewing the proc macro detection change

changelog: none
2024-10-10 09:17:20 +00:00
y21
c8725f70e7 add proc macro check to needless_return 2024-09-26 17:44:59 +02:00
VictorHugoPilled
ae5f857096 fix: Specifying reason in expect(clippy::needless_return) no longer triggers false positive
chore: Moved new tests into needless_return.rs

chore: Ran cargo uibless

Initial commit
2024-09-18 06:10:51 +00:00
apoisternex
af35dcd330 Fix [needless_return] false negative when returned expression borrows a value
Fixes #12907

changelog: Fix [`needless_return`] false negative when returned expression borrows a value
2024-08-03 21:24:51 -03:00
xFrednet
903874d2f4
needless_return: Support #[expect] on the return statement 2024-07-03 20:58:21 +02:00
xFrednet
1b4c281fe7 RFC 2383: Stabilize lint_reasons in Clippy 🖇️ 2024-06-25 17:50:48 +02:00
Philipp Krones
f67f72695a Merge commit 'c9139bd546' into clippy-subtree-update 2024-05-30 10:49:05 +02:00
Philipp Krones
0e62b18435 Merge commit '9d6f41691e' into clippy-subtree-update 2024-03-21 22:20:40 +01:00
Philipp Krones
cc61aeea54 Merge commit '080b587854' into clippyup 2023-08-24 21:32:12 +02:00
Philipp Krones
e6dc0efc00 Merge commit '30448e8cf9' into clippyup 2023-06-02 11:41:57 +02:00
Philipp Krones
b76b0aeb63 Merge commit '435a8ad86c' into clippyup 2023-05-20 15:39:26 +02:00
Philipp Krones
a1b75c5108 Merge commit 'a3ed905928' into clippyup 2023-04-23 13:28:56 +02:00
Philipp Krones
6b95029f17 Merge commit '83e42a2337' into clippyup 2023-04-11 15:31:08 +02:00
Jason Newcomb
0413fb35ba Merge commit '149392b0ba' into clippyup 2023-02-25 19:28:50 -05:00
Philipp Krones
5c7a65251a Merge commit '1480cea393' into clippyup 2023-01-27 21:09:08 +01:00
Philipp Krones
d21616737b Merge commit '7f27e2e74e' into clippyup 2023-01-12 19:48:13 +01:00
Philipp Krones
4ccafea92d Merge commit '4f3ab69ea0' into clippyup 2022-12-29 14:28:34 +01:00
Philipp Krones
d05e2865a0 Merge commit 'd822110d3b' into clippyup 2022-12-01 18:29:38 +01:00
Philipp Krones
d75b25faab Merge commit 'ac0e10aa68' into clippyup 2022-10-06 09:44:38 +02:00
est31
2be8b73328 Fix clippy 2022-09-15 21:21:18 +02:00
Jason Newcomb
fb41bfa774 Merge commit 'f51aade56f' into clippyup 2022-08-31 09:24:45 -04:00
Philipp Krones
09f5df5087 Merge commit '0cb0f76368' into clippyup 2022-06-30 10:50:09 +02:00
Philipp Krones
f067783461 Merge commit 'd9ddce8a22' into clippyup 2022-06-04 13:34:07 +02:00
flip1995
97ab44ca97 Merge commit '0eff589afc' into clippyup 2021-12-30 15:10:43 +01:00
flip1995
8fea1d94f3 Merge commit 'a5d597637d' into clippyup 2021-12-06 12:33:31 +01:00
flip1995
e674d0a599 Merge commit 'e181011378' into clippyup 2021-11-04 12:52:36 +00:00
flip1995
5cf4984872 Merge commit 'b7f3f7f608' into clippyup 2021-10-07 11:21:30 +02:00
flip1995
23d5457e6d Merge commit 'cb7915b00c' into clippyup 2021-09-28 18:03:12 +01:00
flip1995
02bf692169 Merge commit '98e2b9f25b' into clippyup 2021-04-22 11:31:13 +02:00
flip1995
f6d1f368db Merge commit 'b40ea209e7' into clippyup 2021-04-08 17:50:13 +02:00
flip1995
ac912be984 Merge commit '95c0459217' into clippyup 2021-01-30 18:06:34 +01:00
flip1995
488153ff2f Merge commit '953f024793' into clippyup 2021-01-15 10:56:44 +01:00
flip1995
282c59820b Merge commit '3d0b0e66af' into clippyup 2020-08-28 18:43:25 +02:00
David Tolnay
ef28361293
Downgrade match_bool to pedantic 2020-04-23 16:30:06 -07:00
Manish Goregaokar
a9a3350455 needless_return: add allow()s to test, make rustfixable 2019-09-25 14:45:18 -07:00