I have some slighly odd config to make rust-analyzer work (in vscode). This ends up with rust-analyzer running cargo in a quite different way to how I run cargo via the terminal. This means each time rust-analzyer runs cargo after I have run cargo from the terminal it forces a rebuild (and visa-versa). Fix is to make rust-analyzer's cargo use a completely seperate set of build artifacts to the cargo I run from the terminal. Add this to vscode's json settings:
{