Skip to content

Instantly share code, notes, and snippets.

@U007D
Last active February 22, 2018 02:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save U007D/fdb165d302e0f55a01f16c81c9f1a115 to your computer and use it in GitHub Desktop.
Save U007D/fdb165d302e0f55a01f16c81c9f1a115 to your computer and use it in GitHub Desktop.
fn main() {
let opt = Opt::from_args();
if let Err(err) = run(&opt) {
eprintln!("error: {}", err);
std::process::exit(1);
}
}
// ->
#![feature(termination_trait)]
extern crate failure;
use failure::Error as FailureError;
type Result<T> = std::result::Result<(), FailureError>
fn main() -> Result<()> {
let opt = Opt::from_args();
run(&opt)
}
@U007D
Copy link
Author

U007D commented Feb 22, 2018

8 lines of logic -> 4 (or 3 with run(&Opt::from_args)).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment