How to resolve "unresolved import" in Rust when using VS Code?

Got a fix!

In VSC, select Extensions, select the Code Runner extension, click the little gear symbol and select Extension Settings. It's the Code-runner: Executor Map setting that needs to be changed. Click the 'Edit in settings.json' link.

Add the following to the file:

"code-runner.executorMap": {
   "rust": "cargo run # $fileName"
}

If you already have content in the settings.json file then remember to add a comma to the line above and put your edit inside the outermost curly braces, e.g.

{
    "breadcrumbs.enabled": true,
    "code-runner.clearPreviousOutput": true,
    "code-runner.executorMap": {
        "rust": "cargo run # $fileName"
    }
}

This tells Code Runner to use the 'cargo run' command, instead of 'rustc'

This fix came from this question on stackoverflow.