The following will allow you to automatically have a workspace-specific separate build directory for rust-analyzer:
in userSettings.json
(vscode):
"rust-analyzer.server.extraEnv": {
"CARGO_TARGET_DIR": "target/analyzer"
},
"rust-analyzer.check.extraArgs": [
"--target-dir=target/analyzer"
]
adapted from: rust-lang/rust-analyzer#6007 (comment) and rust-lang/rust-analyzer#6007 (comment)