Skip to content

Fix suggestions for async closures in redundant_closure_call - #9053

Merged
bors merged 1 commit into
rust-lang:masterfrom
AaronC81:fix-9052
Aug 2, 2022
Merged

Fix suggestions for async closures in redundant_closure_call#9053
bors merged 1 commit into
rust-lang:masterfrom
AaronC81:fix-9052

Conversation

@AaronC81

Copy link
Copy Markdown
Contributor

Fixes #9052

changelog: Fix suggestions given by [redundant_closure_call] for async closures

@rust-highfive

Copy link
Copy Markdown

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @flip1995 (or someone else) soon.

Please see the contribution instructions for more information.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Jun 25, 2022
@AaronC81

AaronC81 commented Jun 26, 2022

Copy link
Copy Markdown
Contributor Author

Just realised the suggestion is incorrect for single-expression blocks: (async || 42)() gives the suggestion async 42 which is a syntax error. I'll see if I can sort this out

Edit: Pushed a commit and new test for this case. The string interpolation feels a bit dirty here; if necessary, I'd be happy to have a shot at manipulating the AST properly, though I haven't done this with Rust's AST before!

Comment thread clippy_lints/src/redundant_closure_call.rs Outdated

@flip1995 flip1995 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! LGTM. Please squash your commits and this is ready to go.

@AaronC81

Copy link
Copy Markdown
Contributor Author

Squashed!

@flip1995

Copy link
Copy Markdown
Member

@bors r+

Thanks!

@bors

bors commented Jul 15, 2022

Copy link
Copy Markdown
Contributor

☔ The latest upstream changes (presumably #9174) made this pull request unmergeable. Please resolve the merge conflicts.

Fix redundant_closure_call for single-expression async closures

Add Sugg::asyncify

Use Sugg for redundant_closure_call implementation
@flip1995

flip1995 commented Aug 2, 2022

Copy link
Copy Markdown
Member

What happened here? 🤔 Was bors on vacation?

@bors r+

@bors

bors commented Aug 2, 2022

Copy link
Copy Markdown
Contributor

📌 Commit 4c43aa7 has been approved by flip1995

It is now in the queue for this repository.

@bors

bors commented Aug 2, 2022

Copy link
Copy Markdown
Contributor

⌛ Testing commit 4c43aa7 with merge 05e7d54...

@bors

bors commented Aug 2, 2022

Copy link
Copy Markdown
Contributor

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: flip1995
Pushing 05e7d54 to master...

@bors
bors merged commit 05e7d54 into rust-lang:master Aug 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties

Projects

None yet

Development

Successfully merging this pull request may close these issues.

redundant_closure_call gives invalid suggestion for an async closure

4 participants