refactor: drop constraint on Future's Output#213
Merged
Xuanwo merged 3 commits intoXuanwo:mainfrom Sep 14, 2025
Merged
Conversation
We don't actually care what the sleeping returns, we just don't use this return value. While some runtimes such as tokio chose to return (), others such as smol return the Instant at which the sleep ended. Enforcing the output to () makes implementing Sleeper on e.g. smol more difficult that necessary as it forces the user to wrap e.g. smol::Timer into another future (such as futures::future::Map) instead of using the runtime types directly.
Clippy started complaining about this and makes the CI fail
---- backon/src/lib.rs - (line 91) stdout ---- error: The default runtime flavor is , but the feature is disabled. --> backon/src/lib.rs:102:1 | 13 | #[tokio::main] | ^^^^^^^^^^^^^^
Contributor
Author
|
@Xuanwo I can split the CI fixes in another PR if you want as they are unrelated |
Xuanwo
approved these changes
Sep 14, 2025
Owner
Xuanwo
left a comment
There was a problem hiding this comment.
Thank you for working on this! I believe this change makes sense.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We don't actually care what the sleeping returns, we just don't use this return value.
While some runtimes such as tokio chose to return (), others such as smol return the Instant at which the sleep ended.
Enforcing the output to () makes implementing Sleeper on e.g. smol more difficult that necessary as it forces the user to wrap e.g. smol::Timer into another future (such as futures::future::Map) instead of using the runtime types directly.