From 6ed9b07c419911bfde8b6c5ff6f977b295bf4979 Mon Sep 17 00:00:00 2001 From: user1823 <92206575+user1823@users.noreply.github.com> Date: Tue, 6 Jan 2026 19:18:45 +0530 Subject: [PATCH] Add build target directory to Cargo config Anki's build scripts (ninja) set CARGO_TARGET_DIR for their own execution. But, when running cargo commands directly (like cargo check), those commands don't inherit that environment variable and use the default target/ directory instead, leading to duplicate builds. After this change, all cargo commands (check, build, test, etc.) will use the same cache, saving storage space. --- .cargo/config.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.cargo/config.toml b/.cargo/config.toml index 49aaa3a6c..1cdcb7ded 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -13,3 +13,6 @@ color = "always" [target.'cfg(all(target_env = "msvc", target_os = "windows"))'] rustflags = ["-C", "target-feature=+crt-static"] + +[build] +target-dir = "out/rust"