#![ feature( futures_api, async_await ) ]
use std::pin::Pin;
use std::future::Future;
fn must_use() -> Pin<Box< dyn Future<Output=()> >>
{
Box::pin( async
{
println!( "I was used" )
})
}
async fn must_use2() -> ()
{
println!( "I was used 2" )
}
fn main()
{
must_use(); // will not trigger warning
must_use2(); // will trigger warning
}
I wonder whether there's a way around this, since I use it quite alot to have async
trait functions. I hope this can be solved without "newtype" pattern, for hopefully obvious reasons.
That being said I imagine that the async keyword does this by creating a newtype...