From 7723b43663bc12ecedeb3a24d5acf5fc4eb244e2 Mon Sep 17 00:00:00 2001 From: Arsenii Kulikov Date: Sun, 3 Nov 2024 01:49:32 +0400 Subject: [PATCH] fix: use `Debug` when formatting errors (#9251) * fix: use Debug when formatting errors * sh_err * rm newline in handler --- crates/anvil/src/anvil.rs | 2 +- crates/cast/bin/main.rs | 2 +- crates/chisel/bin/main.rs | 2 +- crates/cli/src/handler.rs | 1 - crates/forge/bin/main.rs | 2 +- 5 files changed, 4 insertions(+), 5 deletions(-) diff --git a/crates/anvil/src/anvil.rs b/crates/anvil/src/anvil.rs index 9d4a0cf7ba200..5e2a42f59ef06 100644 --- a/crates/anvil/src/anvil.rs +++ b/crates/anvil/src/anvil.rs @@ -39,7 +39,7 @@ pub enum AnvilSubcommand { fn main() { if let Err(err) = run() { - let _ = foundry_common::Shell::get().error(&err); + let _ = foundry_common::sh_err!("{err:?}"); std::process::exit(1); } } diff --git a/crates/cast/bin/main.rs b/crates/cast/bin/main.rs index 974b7eb861570..f7d66ef9d0d07 100644 --- a/crates/cast/bin/main.rs +++ b/crates/cast/bin/main.rs @@ -39,7 +39,7 @@ static ALLOC: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc; fn main() { if let Err(err) = run() { - let _ = foundry_common::Shell::get().error(&err); + let _ = foundry_common::sh_err!("{err:?}"); std::process::exit(1); } } diff --git a/crates/chisel/bin/main.rs b/crates/chisel/bin/main.rs index 17697688bb3e5..dca99d4a594d4 100644 --- a/crates/chisel/bin/main.rs +++ b/crates/chisel/bin/main.rs @@ -108,7 +108,7 @@ pub enum ChiselSubcommand { fn main() { if let Err(err) = run() { - let _ = foundry_common::Shell::get().error(&err); + let _ = foundry_common::sh_err!("{err:?}"); std::process::exit(1); } } diff --git a/crates/cli/src/handler.rs b/crates/cli/src/handler.rs index 4f69c2ca445c9..b2fbb49d4ea86 100644 --- a/crates/cli/src/handler.rs +++ b/crates/cli/src/handler.rs @@ -15,7 +15,6 @@ impl EyreHandler for Handler { if f.alternate() { return core::fmt::Debug::fmt(error, f) } - writeln!(f)?; write!(f, "{}", error.red())?; if let Some(cause) = error.source() { diff --git a/crates/forge/bin/main.rs b/crates/forge/bin/main.rs index a78218e94e0ab..c713a703ee7bd 100644 --- a/crates/forge/bin/main.rs +++ b/crates/forge/bin/main.rs @@ -22,7 +22,7 @@ static ALLOC: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc; fn main() { if let Err(err) = run() { - let _ = foundry_common::Shell::get().error(&err); + let _ = foundry_common::sh_err!("{err:?}"); std::process::exit(1); } }