Weird rust-analyzer(?) format(?) bug with VSCode only

Hello there! I'm sorry if the title is misleading, this is just the perception I have of the matter at hand.

I have this issue that I can only reproduce with VSCode with the rust-analyzer extension and format on save.

I will first link to a video of the issue that I took, I hope that it's ok for I to link to the following website that I used to host it.

I have the following repro code:

enum Color {

impl Color {
    fn cool_description(&self) -> &str {
        let get_my_description = || match self {
            Self::Red => "cool",
            Self::Green | Self::Blue => "great",


What I do in the video, is I take the | Self::Blue part from the second case in the match arm, and I move it to the first case. Doing this, then pressing CTRL+S leads to a save, which, in the closure, adds a { before the match arm, which generates invalid code. Weird thing are, first, if I do CTRL+Z before the format(?), then CTRL+S again, the issue doesn't persist. Second, I was only able to reproduce this with VSCode, doing the same edit with Notepad and cargo fmt didn't reproduce the issue, which is why I think this may be linked to more specifically rust-analyzer's VSCode extension.

Here are my VSCode settings.json formatting + Rust related entries

    "editor.formatOnSave": true,
    "editor.formatOnType": true,
    "[rust]": {
        "editor.defaultFormatter": "rust-lang.rust-analyzer", 
        "editor.formatOnSave": true 
    "rust-analyzer.completion.autoimport.enable": true,
    "rust-analyzer.inlayHints.lifetimeElisionHints.enable": "always",
    "editor.formatOnSaveMode": "modifications",
    "rust-analyzer.rustfmt.rangeFormatting.enable": true```

Here is my cargo and cargo fmt version

PS E:\repro\repro> cargo --version
cargo 1.67.0-nightly (7e484fc1a 2022-10-27)
PS E:\repro\repro> cargo fmt --version
rustfmt 1.5.1-nightly (09508489 2022-11-04)```

The rust-analyzer extension version is v0.3.1285 nightly.

I think this may be a bug, but I'm not sure, and even if it is... I'm not sure what the cause of the bug is, and thus where to file, which is why I'm posting here. I'm very sorry if this is considered spam - I just don't know any better place for this, as I've came here from the rust-analyzer `editor/code` README. I'd really appreciate some insights as to how I should proceed if case be it's a bug, and if it's not - then I'd appreciate some insights on what could be causing the issue on my end.