stevearc / conform.nvim

Lightweight yet powerful formatter plugin for Neovim
MIT License
2.89k stars 150 forks source link

Allow rust async code to be formatted by rustfmt #321

Closed riftsin closed 6 months ago

riftsin commented 6 months ago

Hello,

This allows rust async code to be formatted with rustfmt.

closes #320

TraceLTRC commented 6 months ago

Rather than passing in the edition. It would be better to use cargo to format it.

158 already solves this, but for some reason the author of the PR closed it before it could get discussed.

riftsin commented 6 months ago

Hmm I'm not sure if that's easily feasible.

One of the issues with using cargo fmt instead of rustfmt is that cargo fmt requires a Cargo.toml in the working directory or a parent directory, rustfmt can be run from anywhere.

What if you are not in a rust project but still opened a rust file ?

There is an option --manifest-path that we can use to specify the path to the Cargo.toml file but can we reliably find it regardless of the current directory ?

stevearc commented 6 months ago

Can I get your opinions on #328?

riftsin commented 6 months ago

328 looks like a better alternative, closing this issue :)