dtolnay / async-trait

Type erasure for async trait methods
Apache License 2.0
1.84k stars 85 forks source link

async-trait should add `must_use` declaration #75

Closed matthauck closed 4 years ago

matthauck commented 4 years ago

async-trait should add #[must_use] declarations on async trait functions. This compiler warning is rather important -- pretty easy to forget to call .await and then have a function call not actually execute that looks like it should be executing.

matthauck commented 4 years ago

Repro: https://gist.github.com/matthauck/9743152133266c50d5593a90867b34c1

I would have expected both do_trait and do_direct calls to fail with a warning.

dtolnay commented 4 years ago

Relevant upstream feature request: https://github.com/rust-lang/rust/issues/67387