Issue
Assume you have a directory with the following rustfmt.toml configuration file:
trailing_semicolon = false
And there's another file in that directory src/main.rs with the following code:
fn foo() -> u32 {
let a: u32 = 1;
let b: u32 = 2;
return a + b
}
fn main() {
println!("{}", foo());
}
And the following VSCode user settings:
"editor.formatOnSave": true,
"[rust]": {
"editor.defaultFormatter": "rust-lang.rust-analyzer"
}
Now, when I open this directory in VSCode, I expected the rust-analyzer extension not to add a trailing semicolon on line 4 (the return statement) when I hit CMD + S. But this is exactly what it does!
return a + b;
I have debugged this for hours and I just can't find the reason for why it happens. What am I missing? Is there any setting I have to apply to make the rust-analyzer extension read the settings from the rustfmt.toml configuration file?
Environment
- macOS v12.4
- VSCode v1.69.2
- rust-analyzer v0.3.1131
- rustfmt v1.4.38-stable
- rustc 1.62.0 (a8314ef7d 2022-06-27)