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

fix: Insert a tail Ok(()) for expr block instead of wrapping with Ok #17763

Merged
merged 1 commit into from
Aug 1, 2024

Conversation

ShoyuVanilla
Copy link
Member

Fixes #17728

When type mismatch is Result<(), E>, () or Option<()>, () and target expr is a block expression, it is more reasonable to insert a wrapped unit - Ok(()) or Some(()) - as the tail expression of that block than wrapping the entire block with Ok or Some

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 1, 2024
@Veykril
Copy link
Member

Veykril commented Aug 1, 2024

Thanks!
@bors r+

@bors
Copy link
Contributor

bors commented Aug 1, 2024

📌 Commit 3121a91 has been approved by Veykril

It is now in the queue for this repository.

@bors
Copy link
Contributor

bors commented Aug 1, 2024

⌛ Testing commit 3121a91 with merge f149dc5...

@bors
Copy link
Contributor

bors commented Aug 1, 2024

☀️ Test successful - checks-actions
Approved by: Veykril
Pushing f149dc5 to master...

@bors bors merged commit f149dc5 into rust-lang:master Aug 1, 2024
11 checks passed
@ShoyuVanilla ShoyuVanilla deleted the wrap-unit branch August 1, 2024 14:33
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.

Quick fix for function no return value, Ok() out of function body
4 participants