If you don't await your variable contains a future - how are you using that like e.g. an int, without a compiler error?
If you don't await your variable contains a future - how are you using that like e.g. an int, without a compiler error?
This means the compiler will emit a warning (can be upgraded to an error) if you forget to await a future even if it doesn't return anything.
[1]: https://doc.rust-lang.org/nightly/src/core/future/future.rs.... [2]: https://doc.rust-lang.org/nightly/src/core/result.rs.html#49...
And turning warnings into errors just encourages people to write 'let _ = ...' to get rid of the error.
> And turning warnings into errors just encourages people to write 'let _ = ...' to get rid of the error.
No? writing `let _ = make_future()` will clearly not await the future, why would you do it instead of just adding `.await` ?
Using `let _ = ...` is sometimes fine for Result if you really sure you don't care about the potential error you got but it's a no go with futures.
warning: unused implementer of `Future` that must be used
--> src/main.rs:9:5
|
9 | foo();
| ^^^^^
|
= note: futures do nothing unless you `.await` or poll them
= note: `#[warn(unused_must_use)]` on by default