When recently working in an async code base I have spent a total of a few hours debugging issues that were simply "oops I didn't await that"
#[must_use_async]
async fn foo() {}
async fn main() {
foo()
}
would cause an error/warning, something like using an async fn without calling .await
has no effect.
Would you mind providing a better example? Yours (if “fixed” by adding a semicolon) gives a warning.
warning: unused implementer of `std::future::Future` that must be used
Including the note
note: futures do nothing unless you `.await` or poll them`
Oh no this is embarrassing I was working in a project with #[allow(unused)]
nooooo.
Thanks for taking the time to respond I thought it was super odd that the compiler wasnt saying anything sorry.
5 Likes
system
Closed
4
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.