Skip to content

refactor: drop constraint on Future's Output#213

Merged
Xuanwo merged 3 commits intoXuanwo:mainfrom
Keruspe:main
Sep 14, 2025
Merged

refactor: drop constraint on Future's Output#213
Xuanwo merged 3 commits intoXuanwo:mainfrom
Keruspe:main

Conversation

@Keruspe
Copy link
Copy Markdown
Contributor

@Keruspe Keruspe commented Sep 13, 2025

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.

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]
   | ^^^^^^^^^^^^^^
@Keruspe
Copy link
Copy Markdown
Contributor Author

Keruspe commented Sep 14, 2025

@Xuanwo I can split the CI fixes in another PR if you want as they are unrelated

Copy link
Copy Markdown
Owner

@Xuanwo Xuanwo left a comment

Choose a reason for hiding this comment

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

Thank you for working on this! I believe this change makes sense.

@Xuanwo Xuanwo changed the title Sleeper: drop constraint on Future's Output refactor: drop constraint on Future's Output Sep 14, 2025
@Xuanwo Xuanwo merged commit de0a041 into Xuanwo:main Sep 14, 2025
7 checks passed
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

Successfully merging this pull request may close these issues.

2 participants