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

Remove method call receiver special casing in unused_async lint #13471

Merged
merged 1 commit into from
Sep 28, 2024

Conversation

y21
Copy link
Member

@y21 y21 commented Sep 28, 2024

Fixes the false positive mentioned in #13466 (comment).

The false negative in the OP would be nice to fix too, but I'd rather do that in a separate PR because it's much more involved

Before this change, the unused_async lint would check if the async fn is also used anywhere and avoid linting if so. The exception is if the async function is immediately called, because the returned future handling can be easily removed (and also if we don't have some exceptions then the lint wouldn't trigger anywhere) or if it's a method call receiver.

I'm not exactly sure why I implemented that special casing for method call receivers in #11200, but it doesn't make much sense in hindsight imo. Especially given that method calls are essentially equivalent to function calls with the receiver as the first argument, which was the primary motivation for not linting in the first place (async fn passed to another function, like axum::get(handler) where handler has to be an async fn).

changelog: none

@rustbot
Copy link
Collaborator

rustbot commented Sep 28, 2024

r? @llogiq

rustbot has assigned @llogiq.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Sep 28, 2024
@llogiq
Copy link
Contributor

llogiq commented Sep 28, 2024

Looks good to me. Thank you!

@bors r+

@bors
Copy link
Contributor

bors commented Sep 28, 2024

📌 Commit d24a631 has been approved by llogiq

It is now in the queue for this repository.

@bors
Copy link
Contributor

bors commented Sep 28, 2024

⌛ Testing commit d24a631 with merge 897f0e4...

@bors
Copy link
Contributor

bors commented Sep 28, 2024

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

@bors bors merged commit 897f0e4 into rust-lang:master Sep 28, 2024
8 checks passed
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.

4 participants