[Auto] bin/core/contact: Fix Clippy warnings
Signed-off-by: flip1995 <hello@philkrones.com> Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This commit is contained in:
parent
3963e5ec2d
commit
5b4b699875
4 changed files with 22 additions and 24 deletions
|
@ -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() {
|
||||
|
|
|
@ -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) {
|
||||
res.map_err_trace_exit_unwrap();
|
||||
} else if ask_continue(&mut input, &mut output) {
|
||||
continue;
|
||||
} else {
|
||||
} else {
|
||||
exit(1)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue