Skip to content

return_and_then: only lint returning expressions #14783

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
May 12, 2025

Conversation

samueltardieu
Copy link
Contributor

@samueltardieu samueltardieu commented May 11, 2025

If an expression is not going to return from the current function of closure, it should not get linted.

This also allows return expression to be linted, in addition to the final expression. Those require blockification and proper indentation.

changelog: [return_and_then]: only lint returning expressions

Fixes #14781

If an expression is not going to return from the current function of
closure, it should not get linted.

This also allows `return` expression to be linted, in addition to the
final expression. Those require blockification and proper indentation.
@rustbot
Copy link
Collaborator

rustbot commented May 11, 2025

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 May 11, 2025
@llogiq
Copy link
Contributor

llogiq commented May 12, 2025

Thank you!

@llogiq llogiq added this pull request to the merge queue May 12, 2025
Merged via the queue into rust-lang:master with commit 459364b May 12, 2025
11 of 13 checks passed
@samueltardieu samueltardieu deleted the issue-14781 branch May 12, 2025 16:32
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.

return_and_then: suggests using ? operator on Option in function which returns Result
3 participants