rust-analyzer / rust-analyzer.github.io

https://rust-analyzer.github.io/
87 stars 51 forks source link

format code fail, if there is an async function #190

Closed wugifer closed 1 year ago

wugifer commented 1 year ago

I wrote this:

fn                  test() {
    let a=1;
}

after formatted, I got this:

fn test() {
    let a = 1;
}

that is ok.

but when I wrote this:

async fn                  test() {
    let a=1;
}

fn test2           (){}

after formatted, nothing happen.

version: rust-analyzer v0.3.1301

wugifer commented 1 year ago

rustup 1.24.3 (ce5817a94 2021-05-31)

wugifer commented 1 year ago

rustfmt 1.4.38-stable (db9d1b20 2022-01-20)

wugifer commented 1 year ago

Cargo.toml:

[package] edition = "2021"

wugifer commented 1 year ago

add edition = "2018" in rustfmt.toml, done

Aloso commented 1 year ago

Please report issues in rust-lang/rust-analyzer in the future. This repo is only for the rust-analyzer website, https://rust-analyzer.github.io/.