Rust.vim RustFmt error: let chains are only allowed in Rust 2024 or later

Asking here in case anyone has a solution since rust.vim seems to no longer be actively maintained (2023, 2024).

I just filed the issue on `RustFmt` error: "let chains are only allowed in Rust 2024 or later" but I'm on 2024 · Issue #529 · rust-lang/rust.vim · GitHub since that's where it belongs, but I wanted to know whether anyone here was aware of a workaround.

Summary of the issue: I have a crate configured as the 2024 edition, but running :RustFmt on a rust file that's using let chains fails with a location list of errors saying:

error: let chains are only allowed in Rust 2024 or later

Does anyone know any workarounds to resolve this issue in vim?

I don't know how rust.vim works, but the most likely cause of this error is that it is directly calling rustfmt without an edition, rather than either passing --edition=2024 or calling cargo fmt.

You can create rustfmt.toml with edition = "2024".

I use vim-lsp with rust-analyzer, and its format commands do use the right edition.

Perfect, thank you!