You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I got the same error here. Here is the full mesage when I just try to run :Format on a project that uses tokio (the message is from rustfmt itself):
Failed to run formatter rustfmt. error[E0670]: `async fn` is not permitted in Rust 2015 --> <stdin>:36:1 |36 | async fn main() { | ^^^^^ to use `async fn`, switch to Rust 2018 or later
| = help: pass `--edition 2021` to `rustc` = note: for more on editions, read https://doc.rust-lang.org/edition-guideerror: expected one of `!`, `)`, `,`, `.`, `::`, `?`, `{`, or an
operator, found keyword `move` --> <stdin>:64:37 |64 | (tokio::spawn(async move { | ^^^^ expected one of 8 possible tokens
One possible workaround is to add a rustfmt.toml file to your project with the contents edition = "2021" or edition = "2018" (see rust-lang/rustfmt#4454). But I agree that we should add an --edition 2021 argument by default.
The
async fn
keyword is not valid in the 2015 version ofrustfmt
.Therefore I suggest that we should add a
--edition 2021
argument to therustfmt
by default .The text was updated successfully, but these errors were encountered: