Use cargo check in its own directory avoiding blocking cargo run

⚓ Rust    📅 2025-11-12    👤 surdeus    👁️ 4      

surdeus

I set up the VS Code settings.json with the following configuration:

{
    "rust-analyzer.checkOnSave": true,
    "rust-analyzer.runnables.extraEnv": {
        "RUST_BACKTRACE": "0"
    },
    "rust-analyzer.cargo.targetDir": true,
    // "rust-analyzer.check.command": "clippy",
    "rust-analyzer.check.overrideCommand": [
        "cargo-clif",
        "check",
        "--workspace",
        "--message-format=json",
        "--all-targets"
    ]
}

This works, but when I run watchexec -- cargo-clif run on the project (it's a web server) to restart it on each change in the codebase, it stops with the following message:

Blocking waiting for file lock on build directory

If I use:

"rust-analyzer.check.command": "clippy",

it doesn't block.

How can I make cargo-clif check work in its own directory?

1 post - 1 participant

Read full topic

🏷️ Rust_feed