summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorflip1995 <hello@philkrones.com>2019-08-27 10:42:46 +0200
committerMatthias Beyer <mail@beyermatthias.de>2019-08-28 18:18:40 +0200
commit5b4b6998751669da8706e203f288a38b5c505253 (patch)
tree4903842288cdde0be58032cba2ab326ff4c1d7fc
parent3963e5ec2d3e0e8a30fdb542b0529cd92acefda3 (diff)
downloadimag-5b4b6998751669da8706e203f288a38b5c505253.tar.gz
imag-5b4b6998751669da8706e203f288a38b5c505253.tar.xz
-rw-r--r--bin/domain/imag-contact/src/create.rs10
-rw-r--r--bin/domain/imag-contact/src/edit.rs14
-rw-r--r--bin/domain/imag-contact/src/main.rs20
-rw-r--r--bin/domain/imag-contact/src/util.rs2
4 files changed, 22 insertions, 24 deletions
diff --git a/bin/domain/imag-contact/src/create.rs b/bin/domain/imag-contact/src/create.rs
index 6176aba0..ff8e2392 100644
--- a/bin/domain/imag-contact/src/create.rs
+++ b/bin/domain/imag-contact/src/create.rs
@@ -56,14 +56,14 @@ use libimagerror::trace::trace_error;
use libimagerror::exit::ExitUnwrap;
use libimagutil::warn_result::WarnResult;
-const TEMPLATE : &'static str = include_str!("../static/new-contact-template.toml");
+const TEMPLATE : &str = include_str!("../static/new-contact-template.toml");
#[cfg(test)]
mod test {
use toml::Value;
use super::TEMPLATE;
- const TEMPLATE_WITH_DATA : &'static str = include_str!("../static/new-contact-template-test.toml");
+ const TEMPLATE_WITH_DATA : &str = include_str!("../static/new-contact-template-test.toml");
#[test]
fn test_validity_template_toml() {
@@ -203,7 +203,7 @@ pub fn create(rt: &Runtime) {
}
let vcard_string = write_component(&vcard);
- let _ = dest
+ dest
.write_all(&vcard_string.as_bytes())
.map_err(Error::from)
.map_err_trace_exit_unwrap();
@@ -219,7 +219,7 @@ pub fn create(rt: &Runtime) {
.create_from_path(&location, &ref_config, &collection_name)
.map_err_trace_exit_unwrap();
- let _ = rt.report_touched(entry.get_location()).unwrap_or_exit();
+ rt.report_touched(entry.get_location()).unwrap_or_exit();
info!("Created entry in store");
} else {
@@ -578,7 +578,7 @@ mod test_parsing {
use std::io::empty;
// TODO
- const TEMPLATE : &'static str = include_str!("../static/new-contact-template-test.toml");
+ const TEMPLATE : &str = include_str!("../static/new-contact-template-test.toml");
#[test]
fn test_template_names() {
diff --git a/bin/domain/imag-contact/src/edit.rs b/bin/domain/imag-contact/src/edit.rs
index 4de4da00..78e436ba 100644
--- a/bin/domain/imag-contact/src/edit.rs
+++ b/bin/domain/imag-contact/src/edit.rs
@@ -73,14 +73,12 @@ pub fn edit(rt: &Runtime) {
loop {
let res = edit_contact(&rt, &contact, &ref_config, collection_name, force_override);
if !retry {
- let _ = res.map_err_trace_exit_unwrap();
- } else {
- if ask_continue(&mut input, &mut output) {
- continue;
- } else {
- exit(1)
- }
- }
+ res.map_err_trace_exit_unwrap();
+ } else if ask_continue(&mut input, &mut output) {
+ continue;
+} else {
+ exit(1)
+}
}
});
}
diff --git a/bin/domain/imag-contact/src/main.rs b/bin/domain/imag-contact/src/main.rs
index 5188f829..8880d670 100644
--- a/bin/domain/imag-contact/src/main.rs
+++ b/bin/domain/imag-contact/src/main.rs
@@ -128,10 +128,10 @@ fn list(rt: &Runtime) {
.map_err_trace_exit_unwrap()
.into_get_iter()
.trace_unwrap_exit()
- .map(|fle| fle.ok_or_else(|| Error::from(err_msg("StoreId not found".to_owned()))))
+ .map(|fle| fle.ok_or_else(|| err_msg("StoreId not found".to_owned())))
.trace_unwrap_exit()
.map(|fle| {
- let _ = rt.report_touched(fle.get_location()).unwrap_or_exit();
+ rt.report_touched(fle.get_location()).unwrap_or_exit();
fle
})
.map(|e| e.deser())
@@ -191,7 +191,7 @@ fn import(rt: &Runtime) {
.retrieve_from_path(&path, &ref_config, &collection_name, force_override)
.map_err_trace_exit_unwrap();
- let _ = rt.report_touched(entry.get_location()).unwrap_or_exit();
+ rt.report_touched(entry.get_location()).unwrap_or_exit();
} else if path.is_dir() {
for entry in WalkDir::new(path).min_depth(1).into_iter() {
let entry = entry
@@ -205,7 +205,7 @@ fn import(rt: &Runtime) {
.retrieve_from_path(&pb, &ref_config, &collection_name, force_override)
.map_err_trace_exit_unwrap();
- let _ = rt.report_touched(fle.get_location()).unwrap_or_exit();
+ rt.report_touched(fle.get_location()).unwrap_or_exit();
info!("Imported: {}", entry.path().to_str().unwrap_or("<non UTF-8 path>"));
} else {
warn!("Ignoring non-file: {}", entry.path().to_str().unwrap_or("<non UTF-8 path>"));
@@ -234,7 +234,7 @@ fn show(rt: &Runtime) {
.render("format", &data)
.map_err(Error::from)
.map_err_trace_exit_unwrap();
- let _ = writeln!(outlock, "{}", s).to_exit_code().unwrap_or_exit();
+ writeln!(outlock, "{}", s).to_exit_code().unwrap_or_exit();
});
}
@@ -275,7 +275,7 @@ fn find(rt: &Runtime) {
|| card.fullname().iter().any(|a| str_contains_any(a, &grepstring));
if take {
- let _ = rt.report_touched(entry.get_location()).unwrap_or_exit();
+ rt.report_touched(entry.get_location()).unwrap_or_exit();
// optimization so we don't have to parse again in the next step
Some((entry, card))
@@ -326,7 +326,7 @@ fn find(rt: &Runtime) {
.map_err(Error::from)
.map_err_trace_exit_unwrap();
- let _ = writeln!(rt.stdout(), "{}", s)
+ writeln!(rt.stdout(), "{}", s)
.to_exit_code()
.unwrap_or_exit();
});
@@ -342,17 +342,17 @@ fn get_contact_print_format(config_value_path: &'static str, rt: &Runtime, scmd:
.map(String::from)
.unwrap_or_else(|| {
rt.config()
- .ok_or_else(|| Error::from(err_msg("No configuration file")))
+ .ok_or_else(|| err_msg("No configuration file"))
.map_err_trace_exit_unwrap()
.read_string(config_value_path)
.map_err(Error::from)
.map_err_trace_exit_unwrap()
- .ok_or_else(|| Error::from(err_msg("Configuration 'contact.list_format' does not exist")))
+ .ok_or_else(|| err_msg("Configuration 'contact.list_format' does not exist"))
.map_err_trace_exit_unwrap()
});
let mut hb = Handlebars::new();
- let _ = hb
+ hb
.register_template_string("format", fmt)
.map_err(Error::from)
.map_err_trace_exit_unwrap();
diff --git a/bin/domain/imag-contact/src/util.rs b/bin/domain/imag-contact/src/util.rs
index 0ed8be05..2b6a003a 100644
--- a/bin/domain/imag-contact/src/util.rs
+++ b/bin/domain/imag-contact/src/util.rs
@@ -107,7 +107,7 @@ pub fn find_contact_by_hash<'a, H: AsRef<str>>(rt: &'a Runtime, hash: H)
.unwrap() // exited above
.starts_with(hash.as_ref())
{
- let _ = rt.report_touched(entry.get_location()).unwrap_or_exit();
+ rt.report_touched(entry.get_location()).unwrap_or_exit();
Some(entry)
} else {
None