diff options
Diffstat (limited to 'bin/domain/imag-mail/src/lib.rs')
-rw-r--r-- | bin/domain/imag-mail/src/lib.rs | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/bin/domain/imag-mail/src/lib.rs b/bin/domain/imag-mail/src/lib.rs index a892d0b5..701a8070 100644 --- a/bin/domain/imag-mail/src/lib.rs +++ b/bin/domain/imag-mail/src/lib.rs @@ -62,9 +62,8 @@ extern crate libimagentryedit; use std::io::Write; use std::io::BufRead; -use failure::Fallible as Result; -use failure::err_msg; -use failure::Error; +use anyhow::Result; +use anyhow::Error; use clap::App; use resiter::AndThen; use resiter::IterInnerOkOrElse; @@ -97,7 +96,7 @@ use config::MailConfig; pub enum ImagMail {} impl ImagApplication for ImagMail { fn run(rt: Runtime) -> Result<()> { - match rt.cli().subcommand_name().ok_or_else(|| err_msg("No subcommand called"))? { + match rt.cli().subcommand_name().ok_or_else(|| anyhow!("No subcommand called"))? { "import" => import::import(&rt), "list" => list(&rt), "print-id" => print_id(&rt), @@ -133,9 +132,9 @@ impl ImagApplication for ImagMail { fn list(rt: &Runtime) -> Result<()> { let config = rt.config() - .ok_or_else(|| err_msg("Configuration missing"))? + .ok_or_else(|| anyhow!("Configuration missing"))? .read_partial::<MailConfig>()? - .ok_or_else(|| err_msg("Configuration for \"mail\" missing"))?; + .ok_or_else(|| anyhow!("Configuration for \"mail\" missing"))?; debug!("Listing mail"); let scmd = rt.cli().subcommand_matches("list").unwrap(); @@ -216,11 +215,11 @@ fn list(rt: &Runtime) -> Result<()> { } else { // use StoreIds to find mails let iter = rt.ids::<crate::ui::PathProvider>()? - .ok_or_else(|| err_msg("No ids supplied"))? + .ok_or_else(|| anyhow!("No ids supplied"))? .into_iter() .map(Ok) .into_get_iter(rt.store()) - .map_inner_ok_or_else(|| err_msg("Did not find one entry")) + .map_inner_ok_or_else(|| anyhow!("Did not find one entry")) .and_then_ok(|m| m.is_mail().map(|b| (b, m))) .filter_ok(|tpl| tpl.0) .map_ok(|tpl| tpl.1); @@ -232,11 +231,11 @@ fn list(rt: &Runtime) -> Result<()> { fn print_id(rt: &Runtime) -> Result<()> { rt.ids::<crate::ui::PathProvider>()? - .ok_or_else(|| err_msg("No ids supplied"))? + .ok_or_else(|| anyhow!("No ids supplied"))? .into_iter() .map(Ok) .into_get_iter(rt.store()) - .map_inner_ok_or_else(|| err_msg("Did not find one entry")) + .map_inner_ok_or_else(|| anyhow!("Did not find one entry")) .and_then_ok(|fle| { let id = fle.get_cached_id()?; writeln!(rt.stdout(), "{}", id)?; |