async-std
async-std copied to clipboard
println (and other macros) warning without .await
It would be neat if println!("Hello, world"); could raise a compiler warning because of the missing .await.
Thanks!
There is no missing await in this example.
I was going to comment exactly that, but was surprised to discover that async_std does in fact have async versions of the println macros https://docs.rs/async-std/1.9.0/async_std/macro.println.html
Oh, I suppose that's not all that surprising, since println has some amount of blocking behavior normally, depending on what you ware writing to, and on which OS platform and (insert many Node.js issues about this exact problem).
I think this should warn anyways, since futures normally warn when you do not consume their output.
If not, then #[must_use] should be added to _print and _eprint: https://github.com/async-rs/async-std/blob/master/src/io/stdio.rs
if that doesn't resolve the problem because macros then there probably is not a solution.