Closed jtdowney closed 1 year ago
I'll get the tests fixed and push another commit when I get some time.
After digging into this, it appears I was mistaken, and cargo fmt
can't be used because it formats everything, not a single file. However, as a workaround, you can tell rustfmt about the edition in rustfmt.toml
as well, and that works with apheleia as is.
Ah gotcha. Cool, thanks!
FYI you can also set the rust edition within your emacs config as an argument to rustfmt
instead of an external rustfmt.toml
file, like this:
(add-to-list 'apheleia-formatters '(rustfmt . ("rustfmt" "--quiet" "--emit" "stdout" "--edition" "2021")))
While attempting to format Rust code that uses async functions and new syntax, apheleia runs
rustfmt
without an edition specified, which causes an error. This change usescargo fmt
instead, which uses the configured Rust edition from theCargo.toml
file to invoke rustfmt.This is the error I was getting before the change: