From b74e4f57e40b1f6a0c95eff030d3ab41c2e9cff7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20R=C3=BC=C3=9Fler?= Date: Thu, 23 Aug 2018 10:59:13 +0200 Subject: [PATCH] Pretty print errors using Display instead of Debug MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Until now, error reporting relied on the default behaviour of Rust’s `Termination` trait which would print a debug representation in case of an error. --- src/main.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 1df123f..04ab4ad 100644 --- a/src/main.rs +++ b/src/main.rs @@ -372,7 +372,7 @@ fn fallback(path: &Path, flags: &Flags) -> Result, Error> { node.map(|node| Some(node)) } -fn main() -> Result<(), Error> { +fn run() -> Result<(), Error> { let matches = App::new("git-tree") .version(env!("CARGO_PKG_VERSION")) .author("Christoph Rüßler ") @@ -429,3 +429,9 @@ fn main() -> Result<(), Error> { Ok(()) } + +fn main() { + if let Err(err) = run() { + println!("{}", err); + } +}