Skip to content
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

Do not consider async { (impl IntoFuture).await } as redundant #11967

Merged
merged 1 commit into from Dec 25, 2023

Conversation

samueltardieu
Copy link
Contributor

changelog: [redundant_async_block]: do not trigger on IntoFuture instances

Fix #11959

@rustbot
Copy link
Collaborator

rustbot commented Dec 15, 2023

r? @dswij

(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 Dec 15, 2023
@samueltardieu
Copy link
Contributor Author

r? @llogiq

@rustbot rustbot assigned llogiq and unassigned dswij Dec 22, 2023
@@ -49,6 +50,9 @@ impl<'tcx> LateLintPass<'tcx> for RedundantAsyncBlock {
let Some(expr) = desugar_await(peel_blocks(body_expr)) &&
// The await prefix must not come from a macro as its content could change in the future.
expr.span.eq_ctxt(body_expr.span) &&
// The await prefix must implement Future, as implementing IntoFuture is not enough.
let Some(future_trait) = cx.tcx.lang_items().future_trait() &&
Copy link
Contributor

Choose a reason for hiding this comment

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

This check means that the whole lint will be deactivated if lang items have no future.

That's totally OK, I just wanted to make that pun.

@llogiq
Copy link
Contributor

llogiq commented Dec 25, 2023

Thank you!

@bors r+

@bors
Copy link
Collaborator

bors commented Dec 25, 2023

📌 Commit e52405a has been approved by llogiq

It is now in the queue for this repository.

@bors
Copy link
Collaborator

bors commented Dec 25, 2023

⌛ Testing commit e52405a with merge 99c7838...

@bors
Copy link
Collaborator

bors commented Dec 25, 2023

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: llogiq
Pushing 99c7838 to master...

@bors bors merged commit 99c7838 into rust-lang:master Dec 25, 2023
5 checks passed
@samueltardieu samueltardieu deleted the issue-11959 branch January 7, 2024 10:12
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.

False positive redundant_async_block when making a Future from an IntoFuture
5 participants