Commit graph

13 commits

Author SHA1 Message Date
Ethiraric
0d59345907 [redundant_closure_call]: Don't lint if closure origins from a macro
The following code used to trigger the lint:
```rs
 macro_rules! make_closure {
     () => {
         (|| {})
     };
 }
 make_closure!()();
```
The lint would suggest to replace `make_closure!()()` with
`make_closure!()`, which changes the code and removes the call to the
closure from the macro. This commit fixes that.

Fixes #12358
2024-02-28 19:17:37 +01:00
Quinn Sinclair
e0228eeb94 Fixes FP in redundant_closure_call when closures are passed to macros
There are cases where the closure call is needed in some macros, this in
particular occurs when the closure has parameters. To handle this case,
we allow the lint when there are no parameters in the closure, or the
closure is outside a macro invocation.

fixes: #11274, #1553
changelog: FP: [`redundant_closure_call`] when closures with parameters
are passed in macros.
2024-01-13 17:45:30 +01:00
Kisaragi Marine
33182495ac
don't add paren on occurrences that is in call args 2023-11-28 00:27:51 +09:00
Kisaragi Marine
1acd8068bd
remove double-paren on test case 2023-11-27 23:50:08 +09:00
Kisaragi Marine
1661e7ee76
re-implement fix for rust-lang#11357 2023-11-27 23:43:39 +09:00
Oli Scherer
3d88fae050 Update ui test crate 2023-08-11 14:02:28 +00:00
y21
3fe2478ecf don't unnecessarily walk more in visitor and add more tests 2023-06-15 22:04:25 +02:00
y21
7280ad9f7b [redundant_closure_call]: handle nested closures 2023-06-11 23:54:48 +02:00
Oli Scherer
def1705a27 Update to a compiletest-rs version that requires //@ for commands 2023-04-20 14:44:03 +00:00
Samuel Tardieu
d5429eab8a Add new redundant_async_block lint 2023-03-08 10:48:54 +01:00
Jason Newcomb
e0eba9cafc Don't cross contexts while building the suggestion for redundant_closure_call 2022-11-30 10:53:27 -05:00
Aaron Christiansen
4c43aa7053 Fix suggestion for async in redundant_closure_call
Fix redundant_closure_call for single-expression async closures

Add Sugg::asyncify

Use Sugg for redundant_closure_call implementation
2022-07-15 15:49:04 +01:00
Manish Goregaokar
a83a8dccba redundant_closure_call: split tests into fixable 2019-09-25 14:45:18 -07:00