diff --git a/crates/cargo-oxide/src/commands/context.rs b/crates/cargo-oxide/src/commands/context.rs index 7ec0f9a85b..100cc5d01e 100644 --- a/crates/cargo-oxide/src/commands/context.rs +++ b/crates/cargo-oxide/src/commands/context.rs @@ -97,8 +97,8 @@ pub fn resolve_context() -> Context { /// only located via [`backend::backend_so_candidate`], never built and never /// cloned, and an invalid `.cargo/cuda-oxide.toml` degrades to defaults with /// a warning instead of exiting (so `doctor` can report it as a failed -/// check). Passive commands such as `doctor` and `clean` must remain usable -/// without triggering backend setup or network access. +/// check). Passive commands such as `doctor`, `clean`, `list` and `fmt` must +/// remain usable without triggering backend setup or network access. /// `run`/`build`/`pipeline`/`setup` still build the backend on demand. pub fn resolve_passive_context() -> Context { if let Some(workspace_root) = backend::find_workspace_root() { diff --git a/crates/cargo-oxide/src/main.rs b/crates/cargo-oxide/src/main.rs index 8f1b2ef349..32bfa3eec8 100644 --- a/crates/cargo-oxide/src/main.rs +++ b/crates/cargo-oxide/src/main.rs @@ -1035,7 +1035,12 @@ fn main() { commands::list_examples(&ctx, json); } Commands::Fmt { check } => { - let ctx = commands::resolve_context(); + // Formatting compiles no device code. `format_all` reads only + // `workspace_root`, `codegen_crate` and `examples_dir`, which the + // passive resolver fills in identically, so eager resolution only + // added a backend build -- and a clone on a fresh checkout -- ahead + // of the first file being formatted. + let ctx = commands::resolve_passive_context(); commands::format_all(&ctx, check); } Commands::New { name, async_mode } => {