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

Return (Result<(),E>,) in drain_the_queue #8585

Closed
wants to merge 1 commit into from

Conversation

est31
Copy link
Member

@est31 est31 commented Aug 4, 2020

This refactors the drain_the_queue function to return a
tuple containing Result. That way, it's still not
possible to use ? or try! to handle errors,
but for readers of the function declaration it's
clearer now that the error actually indicates one.

Bonus: it makes the calling code of drain_the_queue simpler.

This refactors the drain_the_queue function to return a
tuple containing Result. That way, it's still not
possible to use ? or try! to handle errors,
but for readers of the function declaration it's
clearer now that the error actually indicates one.

Bonus: it makes the calling code of drain_the_queue simpler.
@rust-highfive
Copy link

r? @alexcrichton

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 4, 2020
@est31
Copy link
Member Author

est31 commented Aug 4, 2020

I got the idea for this while working on #8437 as I was wondering how to return something in the case no error happened. It's okay if you reject this PR now, I can also include it as a commit in #8437.

@alexcrichton
Copy link
Member

I personally prefer the previous iteration, I think in general I just find working with 1-tuples pretty weird.

@est31
Copy link
Member Author

est31 commented Aug 5, 2020

Ok I'll include it in #8437 instead, where I'm putting a value into the happy path of the Result, so the option will cease to be viable.

@est31 est31 closed this Aug 5, 2020
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.

3 participants