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

reduce code duplication / unnecessary branches #74

Merged
merged 2 commits into from
Aug 23, 2023
Merged

Conversation

fogti
Copy link
Member

@fogti fogti commented Aug 17, 2023

The first commit removes a duplication in the cache branching in block_on, by introducing temporary stack variables. It would be possible to use an enum instead of these two temporary variables, but it wouldn't have much benefit (while being harder to understand).

The second commit mostly changes TryZip to store only Ok results, omitting unnecessary branching on the unpacking before returning the zipped data. Unfortunately, this changes the type signature of TryZip and related functions.

@fogti fogti added the refactoring Code transformations which leave the semantics/intention of code intact label Aug 17, 2023
@fogti fogti marked this pull request as ready for review August 21, 2023 11:38
src/future.rs Outdated Show resolved Hide resolved
Copy link
Member

@notgull notgull left a comment

Choose a reason for hiding this comment

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

Looks good to me!

@fogti fogti merged commit 7896fcc into master Aug 23, 2023
@fogti fogti deleted the fogti/block-on branch August 23, 2023 15:23
@notgull notgull mentioned this pull request Sep 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactoring Code transformations which leave the semantics/intention of code intact
Development

Successfully merging this pull request may close these issues.

2 participants