diff --git a/src/bin/decasify.rs b/src/bin/decasify.rs index 0249fc6..f9da79f 100644 --- a/src/bin/decasify.rs +++ b/src/bin/decasify.rs @@ -14,16 +14,16 @@ use std::io::BufRead; #[derive(Snafu)] enum Error { #[snafu(display("Failed to identify input"))] - InvalidInput {}, + Input {}, #[snafu(display("Failed to resolve a known locale"))] - InvalidLocale {}, + Locale {}, #[snafu(display("Failed to resolve a known case"))] - InvalidCase {}, + Case {}, #[snafu(display("Failed to resolve a known style guide"))] - InvalidStyleGuide {}, + StyleGuide {}, } // Clap CLI errors are reported using the Debug trait, but Snafu sets up the Display trait. @@ -40,22 +40,20 @@ fn main() -> Result<()> { let version = option_env!("VERGEN_GIT_DESCRIBE").unwrap_or_else(|| env!("CARGO_PKG_VERSION")); let app = Cli::command().version(version); let matches = app.get_matches(); - let locale = matches - .get_one::("locale") - .context(InvalidLocaleSnafu)?; + let locale = matches.get_one::("locale").context(LocaleSnafu)?; let case = matches .get_one::("case") - .context(InvalidCaseSnafu)? + .context(CaseSnafu)? .to_owned(); let style = matches .get_one::("style") - .context(InvalidStyleGuideSnafu)? + .context(StyleGuideSnafu)? .to_owned(); match matches.contains_id("input") { true => { let input: Vec = matches .get_many::("input") - .context(InvalidInputSnafu)? + .context(InputSnafu)? .cloned() .collect(); let input: Vec = vec![input.join(" ")];