Skip to content

fix: [needless_return_with_question_mark] trigger in async functions#16952

Merged
samueltardieu merged 1 commit intorust-lang:masterfrom
Gri-ffin:fix-16950
May 3, 2026
Merged

fix: [needless_return_with_question_mark] trigger in async functions#16952
samueltardieu merged 1 commit intorust-lang:masterfrom
Gri-ffin:fix-16950

Conversation

@Gri-ffin
Copy link
Copy Markdown
Contributor

@Gri-ffin Gri-ffin commented May 1, 2026

fixes #16950

lint should now also trigger over async fns.

changelog: [needless_return_with_question_mark]: fix false negative in async fn bodies.

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label May 1, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented May 1, 2026

r? @Jarcho

rustbot has assigned @Jarcho.
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

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: 7 candidates
  • 7 candidates expanded to 7 candidates
  • Random selection from Jarcho, dswij, llogiq

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 1, 2026

Lintcheck changes for 7db6bf7

Lint Added Removed Changed
clippy::needless_return_with_question_mark 2 0 0

This comment will be updated if you push new changes

Copy link
Copy Markdown
Member

@samueltardieu samueltardieu left a comment

Choose a reason for hiding this comment

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

This should cover async blocks as well:

async fn async_block() -> Result<(), ()> {
    async {
        return Err(())?;
    }
    .await
}

View changes since this review

@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label May 3, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented May 3, 2026

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@rustbot rustbot added the S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status) label May 3, 2026
@Gri-ffin
Copy link
Copy Markdown
Contributor Author

Gri-ffin commented May 3, 2026

@rustbot ready

I added async blocks tests.

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties and removed S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status) labels May 3, 2026
@samueltardieu samueltardieu added this pull request to the merge queue May 3, 2026
Merged via the queue into rust-lang:master with commit 73f2ae7 May 3, 2026
11 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label May 3, 2026
@Gri-ffin Gri-ffin deleted the fix-16950 branch May 3, 2026 15:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

needless_return_with_question_mark is not triggered in async functions

4 participants