summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2019-11-23 20:22:31 +0100
committerMatthias Beyer <mail@beyermatthias.de>2019-12-22 19:02:21 +0100
commit0464bfba53255814aadc35d9927c8d0fff2eb00d (patch)
tree1f2f6b26bd37ee639603ac5e3412d05a88b412aa
parent84bb05035b51b05734eef44657cffd1fdb2950db (diff)
Remove error conversion which is not necessary anymore.
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
-rw-r--r--bin/core/imag-category/src/lib.rs2
-rw-r--r--bin/core/imag-gps/src/lib.rs6
-rw-r--r--bin/core/imag-grep/src/lib.rs3
-rw-r--r--bin/core/imag-header/src/lib.rs12
-rw-r--r--bin/core/imag-id-in-collection/src/lib.rs3
-rw-r--r--bin/core/imag-ids/src/lib.rs3
-rw-r--r--bin/core/imag-link/src/lib.rs11
-rw-r--r--bin/core/imag-ref/src/lib.rs4
-rw-r--r--bin/core/imag-store/src/create.rs3
-rw-r--r--bin/core/imag-store/src/get.rs3
-rw-r--r--bin/core/imag-store/src/retrieve.rs3
-rw-r--r--bin/core/imag-store/src/update.rs3
-rw-r--r--bin/core/imag-tag/src/lib.rs9
-rw-r--r--bin/core/imag-view/src/lib.rs5
-rw-r--r--bin/domain/imag-calendar/src/lib.rs6
-rw-r--r--bin/domain/imag-todo/src/lib.rs8
16 files changed, 37 insertions, 47 deletions
diff --git a/bin/core/imag-category/src/lib.rs b/bin/core/imag-category/src/lib.rs
index 27fd2d6b..8e70d722 100644
--- a/bin/core/imag-category/src/lib.rs
+++ b/bin/core/imag-category/src/lib.rs
@@ -165,7 +165,7 @@ fn create_category(rt: &Runtime) -> Result<()> {
let name = scmd.value_of("create-category-name").map(String::from).unwrap(); // safed by clap
rt.store()
.create_category(&name)
- .and_then(|e| rt.report_touched(e.get_location()).map_err(Error::from))
+ .and_then(|e| rt.report_touched(e.get_location()))
}
fn delete_category(rt: &Runtime) -> Result<()> {
diff --git a/bin/core/imag-gps/src/lib.rs b/bin/core/imag-gps/src/lib.rs
index 20c3b495..c58a71de 100644
--- a/bin/core/imag-gps/src/lib.rs
+++ b/bin/core/imag-gps/src/lib.rs
@@ -144,7 +144,7 @@ fn add(rt: &Runtime) -> Result<()> {
.ok_or_else(|| format_err!("No such entry: {}", id))?
.set_coordinates(c.clone())?;
- rt.report_touched(&id).map_err(Error::from)
+ rt.report_touched(&id)
})
.collect()
}
@@ -170,7 +170,7 @@ fn remove(rt: &Runtime) -> Result<()> {
writeln!(rt.stdout(), "{}", removed_value)?;
}
- rt.report_touched(&id).map_err(Error::from)
+ rt.report_touched(&id)
})
.collect()
}
@@ -194,7 +194,7 @@ fn get(rt: &Runtime) -> Result<()> {
writeln!(stdout, "{}", value)?;
- rt.report_touched(&id).map_err(Error::from)
+ rt.report_touched(&id)
})
.collect()
}
diff --git a/bin/core/imag-grep/src/lib.rs b/bin/core/imag-grep/src/lib.rs
index 8a04eaf3..be5d4e2a 100644
--- a/bin/core/imag-grep/src/lib.rs
+++ b/bin/core/imag-grep/src/lib.rs
@@ -48,7 +48,6 @@ use std::io::Write;
use regex::Regex;
use clap::App;
-use failure::Error;
use failure::Fallible as Result;
use failure::err_msg;
use resiter::AndThen;
@@ -154,6 +153,6 @@ fn show(rt: &Runtime, e: &Entry, re: &Regex, opts: &Options, count: &mut usize)
*count += 1;
}
- rt.report_touched(e.get_location()).map_err(Error::from)
+ rt.report_touched(e.get_location())
}
diff --git a/bin/core/imag-header/src/lib.rs b/bin/core/imag-header/src/lib.rs
index 243cd939..3fbd9bd5 100644
--- a/bin/core/imag-header/src/lib.rs
+++ b/bin/core/imag-header/src/lib.rs
@@ -180,7 +180,7 @@ fn has<'a, 'e, I>(rt: &Runtime, mtch: &ArgMatches<'a>, iter: I) -> Result<()>
if !rt.output_is_pipe() {
writeln!(output, "{}", entry.get_location())?;
}
- rt.report_touched(entry.get_location()).map_err(Error::from)
+ rt.report_touched(entry.get_location())
} else {
Ok(())
}
@@ -203,7 +203,7 @@ fn hasnt<'a, 'e, I>(rt: &Runtime, mtch: &ArgMatches<'a>, iter: I) -> Result<()>
if !rt.output_is_pipe() {
writeln!(output, "{}", entry.get_location())?;
}
- rt.report_touched(entry.get_location()).map_err(Error::from)
+ rt.report_touched(entry.get_location())
}
})
.collect()
@@ -256,7 +256,7 @@ fn int<'a, 'e, I>(rt: &Runtime, mtch: &ArgMatches<'a>, iter: I) -> Result<()>
}
})
.filter_map_ok(|(b, e)| if b { Some(e) } else { None })
- .and_then_ok(|entry| rt.report_touched(entry.get_location()).map_err(Error::from))
+ .and_then_ok(|entry| rt.report_touched(entry.get_location()))
.collect()
}
@@ -294,7 +294,7 @@ fn float<'a, 'e, I>(rt: &Runtime, mtch: &ArgMatches<'a>, iter: I) -> Result<()>
}
})
.filter_map_ok(|(b, e)| if b { Some(e) } else { None })
- .and_then_ok(|entry| rt.report_touched(entry.get_location()).map_err(Error::from))
+ .and_then_ok(|entry| rt.report_touched(entry.get_location()))
.collect()
}
@@ -320,7 +320,7 @@ fn string<'a, 'e, I>(rt: &Runtime, mtch: &ArgMatches<'a>, iter: I) -> Result<()>
}
})
.filter_map_ok(|(b, e)| if b { Some(e) } else { None })
- .and_then_ok(|entry| rt.report_touched(entry.get_location()).map_err(Error::from))
+ .and_then_ok(|entry| rt.report_touched(entry.get_location()))
.collect()
}
@@ -342,7 +342,7 @@ fn boolean<'a, 'e, I>(rt: &Runtime, mtch: &ArgMatches<'a>, iter: I) -> Result<()
}
})
.filter_map_ok(|(b, e)| if b { Some(e) } else { None })
- .and_then_ok(|entry| rt.report_touched(entry.get_location()).map_err(Error::from))
+ .and_then_ok(|entry| rt.report_touched(entry.get_location()))
.collect()
}
diff --git a/bin/core/imag-id-in-collection/src/lib.rs b/bin/core/imag-id-in-collection/src/lib.rs
index 9c75f54a..72a590bd 100644
--- a/bin/core/imag-id-in-collection/src/lib.rs
+++ b/bin/core/imag-id-in-collection/src/lib.rs
@@ -52,7 +52,6 @@ use std::io::Write;
use filters::filter::Filter;
use failure::Fallible as Result;
-use failure::Error;
use failure::err_msg;
use clap::App;
@@ -113,7 +112,7 @@ impl ImagApplication for ImagIdInCollection {
writeln!(stdout, "{}", id)?;
}
- rt.report_touched(&id).map_err(Error::from)
+ rt.report_touched(&id)
})
.collect()
}
diff --git a/bin/core/imag-ids/src/lib.rs b/bin/core/imag-ids/src/lib.rs
index 43849462..621b1358 100644
--- a/bin/core/imag-ids/src/lib.rs
+++ b/bin/core/imag-ids/src/lib.rs
@@ -52,7 +52,6 @@ use std::io::Write;
use failure::Fallible as Result;
use failure::err_msg;
-use failure::Error;
use resiter::Map;
use resiter::AndThen;
use clap::App;
@@ -92,7 +91,7 @@ impl ImagApplication for ImagIds {
}
}
- rt.report_touched(&id).map_err(Error::from)
+ rt.report_touched(&id)
})
.collect::<Result<()>>()
};
diff --git a/bin/core/imag-link/src/lib.rs b/bin/core/imag-link/src/lib.rs
index bba51892..47d75c93 100644
--- a/bin/core/imag-link/src/lib.rs
+++ b/bin/core/imag-link/src/lib.rs
@@ -72,7 +72,6 @@ use libimagstore::storeid::StoreId;
use url::Url;
use failure::Fallible as Result;
-use failure::Error;
use clap::App;
mod ui;
@@ -179,7 +178,7 @@ fn link_from_to<'a, I>(rt: &'a Runtime, from: &'a str, to: I) -> Result<()>
info!("Ok: {} -> {}", from, entry);
}
- rt.report_touched(from_entry.get_location()).map_err(Error::from)
+ rt.report_touched(from_entry.get_location())
}
fn remove_linking(rt: &Runtime) -> Result<()> {
@@ -198,7 +197,7 @@ fn remove_linking(rt: &Runtime) -> Result<()> {
.map(|id| match rt.store().get(id.clone())? {
Some(mut to_entry) => {
to_entry.remove_link(&mut from)?;
- rt.report_touched(to_entry.get_location()).map_err(Error::from)
+ rt.report_touched(to_entry.get_location())
},
None => {
@@ -217,7 +216,7 @@ fn remove_linking(rt: &Runtime) -> Result<()> {
})
.collect::<Result<Vec<_>>>()?;
- rt.report_touched(from.get_location()).map_err(Error::from)
+ rt.report_touched(from.get_location())
}
fn unlink(rt: &Runtime) -> Result<()> {
@@ -231,7 +230,7 @@ fn unlink(rt: &Runtime) -> Result<()> {
.ok_or_else(|| format_err!("No entry for {}", id))?
.unlink(rt.store())?;
- rt.report_touched(&id).map_err(Error::from)
+ rt.report_touched(&id)
})
.collect()
}
@@ -280,7 +279,7 @@ fn list_linkings(rt: &Runtime) -> Result<()> {
.collect::<Result<Vec<_>>>()?;
}
- rt.report_touched(entry.get_location()).map_err(Error::from)
+ rt.report_touched(entry.get_location())
})
.collect::<Result<Vec<_>>>()?;
diff --git a/bin/core/imag-ref/src/lib.rs b/bin/core/imag-ref/src/lib.rs
index c5b5f982..c4b24db1 100644
--- a/bin/core/imag-ref/src/lib.rs
+++ b/bin/core/imag-ref/src/lib.rs
@@ -131,7 +131,7 @@ fn deref(rt: &Runtime) -> Result<()> {
.ok_or_else(|| Error::from(::libimagerror::errors::ErrorMsg::UTF8Error))
.and_then(|s| writeln!(outlock, "{}", s).map_err(Error::from))?;
- rt.report_touched(&id).map_err(Error::from)
+ rt.report_touched(&id)
},
None => Err(format_err!("No entry for id '{}' found", id))
}
@@ -193,7 +193,7 @@ fn list_dead(rt: &Runtime) -> Result<()> {
unimplemented!()
}?;
- rt.report_touched(entry.get_location()).map_err(Error::from)
+ rt.report_touched(entry.get_location())
} else {
Ok(())
}
diff --git a/bin/core/imag-store/src/create.rs b/bin/core/imag-store/src/create.rs
index a8989a28..3bb5681e 100644
--- a/bin/core/imag-store/src/create.rs
+++ b/bin/core/imag-store/src/create.rs
@@ -26,7 +26,6 @@ use std::io::Read;
use clap::ArgMatches;
use toml::Value;
use failure::Fallible as Result;
-use failure::Error;
use failure::err_msg;
use libimagrt::runtime::Runtime;
@@ -59,7 +58,7 @@ pub fn create(rt: &Runtime) -> Result<()> {
create_with_content_and_header(rt, &path, String::new(), Entry::default_header())?;
}
- rt.report_touched(&path).map_err(Error::from)
+ rt.report_touched(&path)
}
fn create_from_cli_spec(rt: &Runtime, matches: &ArgMatches, path: &StoreId) -> Result<()> {
diff --git a/bin/core/imag-store/src/get.rs b/bin/core/imag-store/src/get.rs
index b47fabc3..aa060fd1 100644
--- a/bin/core/imag-store/src/get.rs
+++ b/bin/core/imag-store/src/get.rs
@@ -20,7 +20,6 @@
use std::path::PathBuf;
use failure::Fallible as Result;
-use failure::Error;
use failure::err_msg;
use libimagrt::runtime::Runtime;
@@ -40,7 +39,7 @@ pub fn get(rt: &Runtime) -> Result<()> {
None => Err(err_msg("No entry found")),
Some(entry) => {
print_entry(rt, scmd, entry)?;
- rt.report_touched(&path).map_err(Error::from)
+ rt.report_touched(&path)
},
}
}
diff --git a/bin/core/imag-store/src/retrieve.rs b/bin/core/imag-store/src/retrieve.rs
index 7ae516d7..511c9348 100644
--- a/bin/core/imag-store/src/retrieve.rs
+++ b/bin/core/imag-store/src/retrieve.rs
@@ -21,7 +21,6 @@ use std::path::PathBuf;
use std::io::Write;
use failure::Fallible as Result;
-use failure::Error;
use clap::ArgMatches;
use libimagstore::store::FileLockEntry;
@@ -39,7 +38,7 @@ pub fn retrieve(rt: &Runtime) -> Result<()> {
.retrieve(path.clone())
.and_then(|e| print_entry(rt, scmd, e))?;
- rt.report_touched(&path).map_err(Error::from)
+ rt.report_touched(&path)
}
pub fn print_entry(rt: &Runtime, scmd: &ArgMatches, e: FileLockEntry) -> Result<()> {
diff --git a/bin/core/imag-store/src/update.rs b/bin/core/imag-store/src/update.rs
index 8f2479fd..c1e2eecc 100644
--- a/bin/core/imag-store/src/update.rs
+++ b/bin/core/imag-store/src/update.rs
@@ -21,7 +21,6 @@ use std::ops::DerefMut;
use std::path::PathBuf;
use failure::Fallible as Result;
-use failure::Error;
use libimagrt::runtime::Runtime;
use libimagstore::storeid::StoreId;
@@ -49,7 +48,7 @@ pub fn update(rt: &Runtime) -> Result<()> {
debug!("New header set");
}
- rt.report_touched(locked_e.get_location()).map_err(Error::from)
+ rt.report_touched(locked_e.get_location())
})
}
diff --git a/bin/core/imag-tag/src/lib.rs b/bin/core/imag-tag/src/lib.rs
index 874ebf5a..3e931609 100644
--- a/bin/core/imag-tag/src/lib.rs
+++ b/bin/core/imag-tag/src/lib.rs
@@ -62,7 +62,6 @@ extern crate env_logger;
use std::io::Write;
use failure::Fallible as Result;
-use failure::Error;
use failure::err_msg;
use resiter::AndThen;
use resiter::Map;
@@ -142,7 +141,7 @@ impl ImagApplication for ImagTag {
}
Ok(e)
})
- .and_then_ok(|e| rt.report_touched(e.get_location()).map_err(Error::from))
+ .and_then_ok(|e| rt.report_touched(e.get_location()))
.collect::<Result<Vec<_>>>()
.map(|_| ())
},
@@ -181,7 +180,7 @@ impl ImagApplication for ImagTag {
}
Ok(e)
})
- .and_then_ok(|e| rt.report_touched(e.get_location()).map_err(Error::from))
+ .and_then_ok(|e| rt.report_touched(e.get_location()))
.collect::<Result<Vec<_>>>()
.map(|_| ())
},
@@ -251,7 +250,7 @@ fn alter(rt: &Runtime, path: StoreId, add: Option<Vec<Tag>>, rem: Option<Vec<Tag
},
}
- rt.report_touched(&path).map_err(Error::from)
+ rt.report_touched(&path)
}
fn list(path: StoreId, rt: &Runtime) -> Result<()> {
@@ -288,7 +287,7 @@ fn list(path: StoreId, rt: &Runtime) -> Result<()> {
writeln!(rt.stdout(), "{}", tags.join(", "))?;
}
- rt.report_touched(&path).map_err(Error::from)
+ rt.report_touched(&path)
}
/// Get the tags which should be added from the commandline
diff --git a/bin/core/imag-view/src/lib.rs b/bin/core/imag-view/src/lib.rs
index d97d8711..b44f0283 100644
--- a/bin/core/imag-view/src/lib.rs
+++ b/bin/core/imag-view/src/lib.rs
@@ -56,7 +56,6 @@ use std::process::Command;
use handlebars::Handlebars;
use toml_query::read::TomlValueReadTypeExt;
-use failure::Error;
use failure::err_msg;
use failure::Fallible as Result;
use resiter::AndThen;
@@ -186,7 +185,7 @@ impl ImagApplication for ImagView {
viewer.view_entry(&entry, &mut outlock)?;
i += 1;
- rt.report_touched(entry.get_location()).map_err(Error::from)
+ rt.report_touched(entry.get_location())
})
.collect()
} else {
@@ -217,7 +216,7 @@ impl ImagApplication for ImagView {
viewer.view_entry(&entry, &mut outlock)?;
i += 1;
- rt.report_touched(entry.get_location()).map_err(Error::from)
+ rt.report_touched(entry.get_location())
})
.collect()
}
diff --git a/bin/domain/imag-calendar/src/lib.rs b/bin/domain/imag-calendar/src/lib.rs
index ff479757..ae0c8fdb 100644
--- a/bin/domain/imag-calendar/src/lib.rs
+++ b/bin/domain/imag-calendar/src/lib.rs
@@ -168,7 +168,7 @@ fn import(rt: &Runtime) -> Result<()> {
.collect::<Result<Vec<_>>>()?
.into_iter()
.flatten()
- .and_then_ok(|fle| rt.report_touched(fle.get_location()).map_err(Error::from));
+ .and_then_ok(|fle| rt.report_touched(fle.get_location()));
if do_fail {
iter.collect()
@@ -256,7 +256,7 @@ fn list(rt: &Runtime) -> Result<()> {
})
.collect::<Result<Vec<_>>>()?;
- rt.report_touched(parsed_entry.get_entry().get_location()).map_err(Error::from)
+ rt.report_touched(parsed_entry.get_entry().get_location())
})
.collect()
}
@@ -303,7 +303,7 @@ fn show(rt: &Runtime) -> Result<()> {
})
.collect::<Result<Vec<_>>>()?;
- rt.report_touched(parsed_entry.get_entry().get_location()).map_err(Error::from)
+ rt.report_touched(parsed_entry.get_entry().get_location())
})
.collect()
}
diff --git a/bin/domain/imag-todo/src/lib.rs b/bin/domain/imag-todo/src/lib.rs
index 96ff913f..9af20181 100644
--- a/bin/domain/imag-todo/src/lib.rs
+++ b/bin/domain/imag-todo/src/lib.rs
@@ -222,7 +222,7 @@ fn create(rt: &Runtime) -> Result<()> {
entry.edit_content(&rt)?;
}
- rt.report_touched(entry.get_location()).map_err(Error::from)
+ rt.report_touched(entry.get_location())
}
fn mark(rt: &Runtime) -> Result<()> {
@@ -233,7 +233,7 @@ fn mark(rt: &Runtime) -> Result<()> {
.map(Ok)
.into_get_iter(rt.store())
.map_inner_ok_or_else(|| err_msg("Did not find one entry"))
- .and_then_ok(|e| rt.report_touched(e.get_location()).map_err(Error::from).map(|_| e))
+ .and_then_ok(|e| rt.report_touched(e.get_location()).map(|_| e))
.and_then_ok(|mut e| e.set_status(status.clone()))
.collect()
}
@@ -339,7 +339,7 @@ fn list_todos(rt: &Runtime, matcher: &StatusMatcher, show_hidden: bool) -> Resul
}
}
- rt.report_touched(entry.get_location()).map_err(Error::from)
+ rt.report_touched(entry.get_location())
})
.collect()
};
@@ -453,7 +453,7 @@ fn show(rt: &Runtime) -> Result<()> {
.map(Ok)
.into_get_iter(rt.store())
.map_inner_ok_or_else(|| err_msg("Did not find one entry"))
- .and_then_ok(|e| rt.report_touched(e.get_location()).map_err(Error::from).map(|_| e))
+ .and_then_ok(|e| rt.report_touched(e.get_location()).map(|_| e))
.collect::<Result<Vec<_>>>()?
.into_iter();