From 175bf3559359373093496fdec59a57fb68a5f6b9 Mon Sep 17 00:00:00 2001 From: Pawel Lisowski Date: Fri, 4 Sep 2026 02:26:47 +0000 Subject: [PATCH] chore(cli): drop the unused anyhow dependency MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `anyhow` was declared in `cli/Cargo.toml` but nothing in the crate ever used it beyond naming `main`'s return type. That return type could not carry a value either: every error path in `main` ends in `std::process::exit`, which diverges, so `Ok(())` was the only value the function could ever produce and no `Err` ever reached the runtime's `Termination` impl. Return `()` from `main` instead and drop the dependency. `cargo tree -i anyhow` now prints nothing for the targets this crate builds, so the crate is no longer compiled at all; it stays in `Cargo.lock` only as a transitive of the wasm-only `wit-*` crates, which are never built here. Exit codes are unchanged — `AwareError::exit_code` already decided them. Verified: 0 on success, 7 on a not-found agent, both before and after. --- cli/Cargo.lock | 1 - cli/Cargo.toml | 1 - cli/src/main.rs | 16 +++++++++------- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/cli/Cargo.lock b/cli/Cargo.lock index 1abbe44ad..dd935ac1d 100644 --- a/cli/Cargo.lock +++ b/cli/Cargo.lock @@ -276,7 +276,6 @@ checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" name = "aware" version = "0.132.0" dependencies = [ - "anyhow", "assert_cmd", "async-trait", "base64", diff --git a/cli/Cargo.toml b/cli/Cargo.toml index 0adf3bd80..94875bc3e 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -19,7 +19,6 @@ serde = { version = "1.0", features = ["derive"] } serde_yaml = "0.9" serde_json = { version = "1.0", features = ["preserve_order"] } thiserror = "2.0" -anyhow = "1.0" dirs = "6.0" ureq = { version = "2", default-features = false, features = ["tls"] } flate2 = "1" diff --git a/cli/src/main.rs b/cli/src/main.rs index 20f19ffa1..de1abbb37 100644 --- a/cli/src/main.rs +++ b/cli/src/main.rs @@ -192,8 +192,13 @@ enum Command { }, } +// Returns `()`, not a `Result`: every error path below ends in +// `std::process::exit`, which diverges, so no `Err` ever reaches the runtime's +// `Termination` impl. Naming an error type here would only claim a failure mode +// that cannot happen — and `AwareError::exit_code` is what actually decides the +// process's exit status, not a returned `Err`. #[tokio::main] -async fn main() -> anyhow::Result<()> { +async fn main() { let cli = Cli::parse(); let paths = match crate::paths::Paths::from_env() { @@ -230,11 +235,8 @@ async fn main() -> anyhow::Result<()> { Command::Sidecar { action } => commands::sidecar::dispatch(action, &ctx), }; - match result { - Ok(()) => Ok(()), - Err(err) => { - eprintln!("error: {err}"); - std::process::exit(err.exit_code()); - } + if let Err(err) = result { + eprintln!("error: {err}"); + std::process::exit(err.exit_code()); } }