summaryrefslogtreecommitdiffstats
path: root/bin/domain/imag-notes/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'bin/domain/imag-notes/src/lib.rs')
-rw-r--r--bin/domain/imag-notes/src/lib.rs16
1 files changed, 8 insertions, 8 deletions
diff --git a/bin/domain/imag-notes/src/lib.rs b/bin/domain/imag-notes/src/lib.rs
index 2c71914c..b3148690 100644
--- a/bin/domain/imag-notes/src/lib.rs
+++ b/bin/domain/imag-notes/src/lib.rs
@@ -37,7 +37,7 @@
extern crate clap;
#[macro_use] extern crate log;
extern crate itertools;
-#[macro_use] extern crate failure;
+#[macro_use] extern crate anyhow;
extern crate resiter;
extern crate libimagnotes;
@@ -51,9 +51,9 @@ use std::io::Write;
use itertools::Itertools;
use clap::App;
-use failure::Error;
-use failure::err_msg;
-use failure::Fallible as Result;
+use anyhow::Error;
+
+use anyhow::Result;
use resiter::IterInnerOkOrElse;
use libimagentryedit::edit::Edit;
@@ -74,7 +74,7 @@ mod ui;
pub enum ImagNotes {}
impl ImagApplication for ImagNotes {
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"))? {
"create" => create(&rt),
"delete" => delete(&rt),
"edit" => edit(&rt),
@@ -84,7 +84,7 @@ impl ImagApplication for ImagNotes {
if rt.handle_unknown_subcommand("imag-notes", other, rt.cli())?.success() {
Ok(())
} else {
- Err(err_msg("Failed to handle unknown subcommand"))
+ Err(anyhow!("Failed to handle unknown subcommand"))
}
},
}
@@ -131,7 +131,7 @@ fn edit(rt: &Runtime) -> Result<()> {
rt
.store()
.get_note(name.clone())?
- .ok_or_else(|| format_err!("Name '{}' not found", name))
+ .ok_or_else(|| anyhow!("Name '{}' not found", name))
.and_then(|mut note| {
note.edit_content(rt).map_warn_err_str("Editing failed")?;
rt.report_touched(note.get_location()).map_err(Error::from)
@@ -145,7 +145,7 @@ fn list(rt: &Runtime) -> Result<()> {
.store()
.all_notes()?
.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"))
.collect::<Result<Vec<_>>>()?
.into_iter()
.sorted_by(|a, b| match (a.get_name(), b.get_name()) {