Skip to content

[unused_async]: do not consider await in nested async blocks as used #10807

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 3 commits into from
May 26, 2023

Conversation

y21
Copy link
Member

@y21 y21 commented May 21, 2023

Fixes #10800.
This PR makes sure that await expressions inside of inner async blocks don't prevent the lint from triggering.
For example

async fn foo() {
  async {
    std::future::ready(()).await;
  }
}

Even though there is a .await expression in this function, it's contained in an async block, which means that the enclosing function doesn't need to be async too.

changelog: [unused_async]: do not consider await in nested async blocks as used

@rustbot
Copy link
Collaborator

rustbot commented May 21, 2023

r? @Jarcho

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label May 21, 2023
@Jarcho
Copy link
Contributor

Jarcho commented May 26, 2023

Thank you. @bors r+

@bors
Copy link
Contributor

bors commented May 26, 2023

📌 Commit 8ef6240 has been approved by Jarcho

It is now in the queue for this repository.

@bors
Copy link
Contributor

bors commented May 26, 2023

⌛ Testing commit 8ef6240 with merge 05740ad...

@bors
Copy link
Contributor

bors commented May 26, 2023

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: Jarcho
Pushing 05740ad to master...

@bors bors merged commit 05740ad into rust-lang:master May 26, 2023
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.

unused_async not triggering when function only uses .await in an async block
4 participants