summaryrefslogtreecommitdiffstats
path: root/bin/domain/imag-mail
diff options
context:
space:
mode:
Diffstat (limited to 'bin/domain/imag-mail')
-rw-r--r--bin/domain/imag-mail/Cargo.toml2
-rw-r--r--bin/domain/imag-mail/src/lib.rs26
-rw-r--r--bin/domain/imag-mail/src/ui.rs2
-rw-r--r--bin/domain/imag-mail/src/util.rs10
4 files changed, 20 insertions, 20 deletions
diff --git a/bin/domain/imag-mail/Cargo.toml b/bin/domain/imag-mail/Cargo.toml
index fd871089..bd59b42b 100644
--- a/bin/domain/imag-mail/Cargo.toml
+++ b/bin/domain/imag-mail/Cargo.toml
@@ -21,7 +21,7 @@ maintenance = { status = "actively-developed" }
[dependencies]
log = "0.4.6"
-failure = "0.1.5"
+anyhow = "1"
resiter = "0.4"
handlebars = "2"
walkdir = "2"
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))
}
diff --git a/bin/domain/imag-mail/src/ui.rs b/bin/domain/imag-mail/src/ui.rs
index 324fabb4..319073d5 100644
--- a/bin/domain/imag-mail/src/ui.rs
+++ b/bin/domain/imag-mail/src/ui.rs
@@ -18,7 +18,7 @@
//
use std::path::PathBuf;
-use failure::Fallible as Result;
+use anyhow::Result;
use libimagstore::storeid::StoreId;
use libimagrt::runtime::IdPathProvider;
diff --git a/bin/domain/imag-mail/src/util.rs b/bin/domain/imag-mail/src/util.rs
index 7f116649..bdd27ba2 100644
--- a/bin/domain/imag-mail/src/util.rs
+++ b/bin/domain/imag-mail/src/util.rs
@@ -21,9 +21,9 @@ use std::collections::BTreeMap;
use std::io::Write;
use clap::ArgMatches;
-use failure::Error;
-use failure::Fallible as Result;
-use failure::err_msg;
+use anyhow::Error;
+use anyhow::Result;
+
use handlebars::Handlebars;
use toml_query::read::TomlValueReadTypeExt;
@@ -37,10 +37,10 @@ pub fn get_mail_print_format(config_value_path: &'static str, rt: &Runtime, scmd
Some(s) => Ok(s),
None => {
rt.config()
- .ok_or_else(|| err_msg("No configuration file"))?
+ .ok_or_else(|| anyhow!("No configuration file"))?
.read_string(config_value_path)
.map_err(Error::from)?
- .ok_or_else(|| format_err!("Configuration '{}' does not exist", config_value_path))
+ .ok_or_else(|| anyhow!("Configuration '{}' does not exist", config_value_path))
}
}?;