How to format Rust code "on save" in VSCode

This article was published on Apr 19, 2021, and takes less than a minute to read.

For some reason, when we install Rust VSCODE extension the formatter does not work by default.To do that I we need to enforce the formatter via settings.json (or User preference):

settings.json
{
    "[rust]": {
        "editor.defaultFormatter": "rust-lang.rust", // Makes the magic
        "editor.formatOnSave": true // Optional
    },
}