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

Move away from excessive use of FutureExt #3360

Closed
kevinkassimo opened this issue Nov 17, 2019 · 3 comments
Closed

Move away from excessive use of FutureExt #3360

kevinkassimo opened this issue Nov 17, 2019 · 3 comments

Comments

@kevinkassimo
Copy link
Contributor

kevinkassimo commented Nov 17, 2019

FutureExt provides our familiar .then, .and_then, .map etc.

However, after switching to std::future::Future, in many places we can switch directly to using async/async move block, or async function (when lifetimes of arguments are not a problem)

In practice, it might be able to save us some unnecessary clones and make the code more readable and tidy.

A demo of such refactoring is #3359

@kevinkassimo
Copy link
Contributor Author

For new contributors who want to work on this:
Search in the codebase the keyword FutureExt, especially many files under cli/ops/.... Try replacing some places where .then/.and_then/.map etc. is used with a complete async block which returns a future.

@bartlomieju
Copy link
Member

FYI I'm working on update to tokio 0.2 which will should remove a few of these usages.

@bartlomieju
Copy link
Member

I think we can close this issue now, we're left with around 20 imports of FutureExt 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants