Another way to do it using rustfmt.toml
Create File rustfmt.toml in your project directory and add this code:
rustfmt.toml
tab_spaces = 2
For reference, you can go to https://rust-lang.github.io/rustfmt/?version=v1.8.0&search=#tab_spaces