Fixing Rust koan errors in Visual Studio Code
After completing Ruby and F# koans, I’ve begun on Rust koans since I’ve been away from Rust for a while. However, immediately after beginning, I experienced rampant “This rust file does not belong to a loaded cargo project” errors in VS Code, basically each time I typed something.
After looking into the issue, I came across a rust analyzer GitHub issue that contains a simple workaround, which I’ll summarize below, adapted for the Rust koans repository:
- Add
mod koans
tomain.rs
- Create a new file in the
src
directory namedkoans.rs
This was sufficient to resolve the issue for me.