diff options
Diffstat (limited to 'bin/domain/imag-mail/src/lib.rs')
-rw-r--r-- | bin/domain/imag-mail/src/lib.rs | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/bin/domain/imag-mail/src/lib.rs b/bin/domain/imag-mail/src/lib.rs index 10d6b850..ceee854d 100644 --- a/bin/domain/imag-mail/src/lib.rs +++ b/bin/domain/imag-mail/src/lib.rs @@ -36,7 +36,7 @@ extern crate clap; #[macro_use] extern crate log; -#[macro_use] extern crate failure; +#[macro_use] extern crate anyhow; extern crate toml_query; extern crate resiter; extern crate handlebars; @@ -53,9 +53,9 @@ extern crate libimaginteraction; use std::path::PathBuf; -use failure::Fallible as Result; -use failure::err_msg; -use failure::Error; +use anyhow::Result; + +use anyhow::Error; use toml_query::read::TomlValueReadTypeExt; use clap::App; use resiter::AndThen; @@ -84,7 +84,7 @@ mod util; 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"))? { "scan" => scan(&rt), "import-mail" => import_mail(&rt), "list" => list(&rt), @@ -95,7 +95,7 @@ impl ImagApplication for ImagMail { if rt.handle_unknown_subcommand("imag-mail", other, rt.cli())?.success() { Ok(()) } else { - Err(err_msg("Failed to handle unknown subcommand")) + Err(anyhow!("Failed to handle unknown subcommand")) } }, } @@ -214,7 +214,7 @@ fn list(rt: &Runtime) -> Result<()> { if rt.ids_from_stdin() { 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); @@ -226,7 +226,7 @@ fn list(rt: &Runtime) -> Result<()> { } .inspect(|id| debug!("Found: {:?}", id)) .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| { crate::util::list_mail(&m, i, &refconfig, &list_format, &mut out)?; rt.report_touched(m.get_location())?; @@ -247,7 +247,7 @@ fn unread(rt: &Runtime) -> Result<()> { if rt.ids_from_stdin() { 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); @@ -257,7 +257,7 @@ fn unread(rt: &Runtime) -> Result<()> { } .inspect(|id| debug!("Found: {:?}", id)) .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| { if !m.is_seen(&refconfig)? { crate::util::list_mail(&m, i, &refconfig, &list_format, &mut out)?; @@ -273,7 +273,7 @@ fn unread(rt: &Runtime) -> Result<()> { fn mail_store(rt: &Runtime) -> Result<()> { let _ = rt.cli().subcommand_matches("mail-store").unwrap(); - Err(format_err!("This feature is currently not implemented.")) + Err(anyhow!("This feature is currently not implemented.")) } fn get_ref_collection_name(rt: &Runtime) -> Result<String> { @@ -282,8 +282,8 @@ fn get_ref_collection_name(rt: &Runtime) -> Result<String> { debug!("Getting configuration: {}", setting_name); rt.config() - .ok_or_else(|| format_err!("No configuration, cannot find collection name for mail collection"))? + .ok_or_else(|| anyhow!("No configuration, cannot find collection name for mail collection"))? .read_string(setting_name)? - .ok_or_else(|| format_err!("Setting missing: {}", setting_name)) + .ok_or_else(|| anyhow!("Setting missing: {}", setting_name)) } |