formulahendry / formulahendry/vscode-code-runner

[PATCH] Rust uses rustc instead of cargo (fix included!)

Open
#837 2 comments 1 reaction 0 assignees View on GitHub
Dominant language
TypeScript
Stars
2.4k
Forks
351
PR merge metrics
No merged PRs in 30d

Description

- VS Code Version: All
- OS Version: Windows 10 latest
- Code Runner Version: Latest

**Describe the bug**
When a rust project is created with cargo (which is most of them now days) it should be run via cargo, not rustc for proper dependency handling

**To Reproduce**
Steps to reproduce the behavior:

1. Attempt to run a rust cargo project

**Actual behavior**
rustc is used on the .rs file you are editing, which is likely to fail due to dependencies

**Expected behavior**
cargo build && cargo run

**Fix**
in settings.json for windows the correct test would be this: ```"rust": "if EXIST Cargo.toml ( cargo run ) ELSE ( rustc $fileName && $dir$fileNameWithoutExt )", ```

Which will check if Cargo.toml is present and if it is use that, elsewhere it will use rustc

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.