diff options
Diffstat (limited to 'bin/domain/imag-todo/src/util.rs')
-rw-r--r-- | bin/domain/imag-todo/src/util.rs | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/bin/domain/imag-todo/src/util.rs b/bin/domain/imag-todo/src/util.rs index bafd40a1..9fce60e6 100644 --- a/bin/domain/imag-todo/src/util.rs +++ b/bin/domain/imag-todo/src/util.rs @@ -18,11 +18,10 @@ // use std::collections::BTreeMap; -use std::result::Result as RResult; -use failure::Fallible as Result; -use failure::Error; -use failure::err_msg; +use anyhow::Result; +use anyhow::Error; + use handlebars::Handlebars; use clap::ArgMatches; use chrono::NaiveDateTime; @@ -33,8 +32,8 @@ use libimagstore::store::Entry; use libimagtodo::entry::Todo; use libimagutil::date::datetime_to_string; -pub fn get_dt_str(d: Result<Option<NaiveDateTime>>, s: &str) -> RResult<String, libimagentryview::error::Error> { - Ok(d.map_err(libimagentryview::error::Error::from)? +pub fn get_dt_str(d: Result<Option<NaiveDateTime>>, s: &str) -> Result<String> { + Ok(d? .map(|v| datetime_to_string(&v)) .unwrap_or_else(|| s.to_string())) } @@ -44,10 +43,10 @@ pub fn get_todo_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)) } }?; |