Skip to content

Fix suggestions for async closures in redundant_closure_call #9053

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 1 commit into from
Aug 2, 2022

Conversation

AaronC81
Copy link
Contributor

Fixes #9052

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

@rust-highfive
Copy link

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
Copy link
Contributor Author

AaronC81 commented Jun 26, 2022

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!

Copy link
Member

@flip1995 flip1995 left a comment

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
Contributor Author

Squashed!

@flip1995
Copy link
Member

@bors r+

Thanks!

@bors
Copy link
Contributor

bors commented Jul 15, 2022

☔ 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
Copy link
Member

flip1995 commented Aug 2, 2022

What happened here? 🤔 Was bors on vacation?

@bors r+

@bors
Copy link
Contributor

bors commented Aug 2, 2022

📌 Commit 4c43aa7 has been approved by flip1995

It is now in the queue for this repository.

@bors
Copy link
Contributor

bors commented Aug 2, 2022

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

@bors
Copy link
Contributor

bors commented Aug 2, 2022

☀️ 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