From c72ee909299e937b5b6e9fa2a8dbc0d1bd938e56 Mon Sep 17 00:00:00 2001 From: Magnus Hoff Date: Sat, 12 May 2018 14:34:09 +0200 Subject: [PATCH] Return Result from main (requires Rust 1.26) --- src/main.rs | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/src/main.rs b/src/main.rs index 972dd56..37bb549 100644 --- a/src/main.rs +++ b/src/main.rs @@ -49,7 +49,7 @@ fn args<'a>() -> clap::ArgMatches<'a> { .get_matches() } -fn core_main() -> Result<(), Box> { +fn main() -> Result<(), Box> { let args = args(); const CLAP: &str = "Guaranteed by clap"; @@ -67,13 +67,3 @@ fn core_main() -> Result<(), Box> { trust_identity, ) } - -fn main() { - match core_main() { - Ok(()) => (), - Err(err) => { - eprintln!("{:#?}", err); - std::process::exit(1) - } - } -}