Bug Report
Version
0.1.29
Description
When using a fn that returns a Pin<Box<dyn Future>> and uses an async move block, I get a bogus unused_braces lint.
use std::future::Future;
use std::pin::Pin;
#[tracing::instrument]
pub fn instumented_fn() -> Pin<Box<dyn Future<Output = ()>>> {
Box::pin(async move { () })
}
The lint is bogus and the suggestion would yield invalid code:
warning: unnecessary braces around block return value
--> src/main.rs:50:25
|
50 | Box::pin(async move { () })
| ^^ ^^
|
= note: `#[warn(unused_braces)]` on by default
help: remove these braces
|
50 - Box::pin(async move { () })
50 + Box::pin(async move ())
|
In our original code we had something along the lines of Box::pin(async move { foo.await.map_err(…)? }).