Skip to content

Conversation

BastiDood
Copy link
Contributor

Hello there! This PR slightly refactors the future::select implementation so that it uses early returns. Although a relatively small change, I believe it makes the code a little bit more readable than the originally nested match expressions. It also makes the control flow clearer since it's more "linear", so to speak.

In line with the readability improvements, I've also renamed the x variable to val so that it's more apparent what x represents.

That is all. Thanks! 🎉

Although a relatively small change, it makes the code a little bit
more readable than the originally nested `match` expressions.
@BastiDood BastiDood requested a review from taiki-e as a code owner April 15, 2022 17:14
Copy link
Member

@taiki-e taiki-e left a comment

Choose a reason for hiding this comment

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

Thanks.

@taiki-e taiki-e merged commit c0e02d2 into rust-lang:master May 28, 2022
@BastiDood BastiDood deleted the refactor/early-return branch May 28, 2022 10:09
taiki-e pushed a commit that referenced this pull request Aug 14, 2022
Although a relatively small change, it makes the code a little bit
more readable than the originally nested `match` expressions.
@taiki-e taiki-e mentioned this pull request Aug 14, 2022
taiki-e pushed a commit that referenced this pull request Aug 14, 2022
Although a relatively small change, it makes the code a little bit
more readable than the originally nested `match` expressions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants