The VS Code Rust plugin assumes RUSTUP_HOME and CARGO_HOME are their default values, which presented a problem for me as I had them installed under /opt. To get around this I added a quick shim script that defines those variables before execing the real executables. Then I created symlinks with the name of each tool pointing to my shim in an location in PATH. In other words, /usr/local/bin looks like this:
/usr/local/bin/
├── cargo -> rustup-shim
├── cargo-clippy -> rustup-shim
├── cargo-fmt -> rustup-shim
├── cargo-miri -> rustup-shim
├── clippy-driver -> rustup-shim
├── rls -> rustup-shim
├── rustc -> rustup-shim