[No-auto] bin/domain/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
7a97c02584
commit
397bcd43d0
2 changed files with 26 additions and 27 deletions
|
@ -95,26 +95,24 @@ fn main() {
|
||||||
build_ui);
|
build_ui);
|
||||||
|
|
||||||
|
|
||||||
rt.cli()
|
if let Some(name) = rt.cli().subcommand_name() {
|
||||||
.subcommand_name()
|
debug!("Call {}", name);
|
||||||
.map(|name| {
|
match name {
|
||||||
debug!("Call {}", name);
|
"list" => list(&rt),
|
||||||
match name {
|
"import" => import(&rt),
|
||||||
"list" => list(&rt),
|
"show" => show(&rt),
|
||||||
"import" => import(&rt),
|
"edit" => edit(&rt),
|
||||||
"show" => show(&rt),
|
"find" => find(&rt),
|
||||||
"edit" => edit(&rt),
|
"create" => create(&rt),
|
||||||
"find" => find(&rt),
|
other => {
|
||||||
"create" => create(&rt),
|
debug!("Unknown command");
|
||||||
other => {
|
let _ = rt.handle_unknown_subcommand("imag-contact", other, rt.cli())
|
||||||
debug!("Unknown command");
|
.map_err_trace_exit_unwrap()
|
||||||
let _ = rt.handle_unknown_subcommand("imag-contact", other, rt.cli())
|
.code()
|
||||||
.map_err_trace_exit_unwrap()
|
.map(::std::process::exit);
|
||||||
.code()
|
},
|
||||||
.map(::std::process::exit);
|
}
|
||||||
},
|
}
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn list(rt: &Runtime) {
|
fn list(rt: &Runtime) {
|
||||||
|
|
|
@ -30,7 +30,7 @@ use libimagrt::runtime::Runtime;
|
||||||
use libimagstore::store::FileLockEntry;
|
use libimagstore::store::FileLockEntry;
|
||||||
|
|
||||||
|
|
||||||
pub fn build_data_object_for_handlebars<'a>(i: usize, vcard: &DeserVcard) -> BTreeMap<&'static str, String> {
|
pub fn build_data_object_for_handlebars(i: usize, vcard: &DeserVcard) -> BTreeMap<&'static str, String> {
|
||||||
let mut data = BTreeMap::new();
|
let mut data = BTreeMap::new();
|
||||||
|
|
||||||
let process_list = |list: &Vec<String>| {
|
let process_list = |list: &Vec<String>| {
|
||||||
|
@ -96,21 +96,22 @@ pub fn find_contact_by_hash<'a, H: AsRef<str>>(rt: &'a Runtime, hash: H)
|
||||||
error!("Failed to get entry");
|
error!("Failed to get entry");
|
||||||
exit(1)
|
exit(1)
|
||||||
}))
|
}))
|
||||||
.filter_map(move |entry| {
|
.filter(move |entry| {
|
||||||
let deser = entry.deser().map_err_trace_exit_unwrap();
|
let deser = entry.deser().map_err_trace_exit_unwrap();
|
||||||
|
|
||||||
if deser.uid()
|
let id_starts_with_hash = deser.uid()
|
||||||
.ok_or_else(|| {
|
.ok_or_else(|| {
|
||||||
error!("Could not get StoreId from Store::all_contacts(). This is a BUG!");
|
error!("Could not get StoreId from Store::all_contacts(). This is a BUG!");
|
||||||
::std::process::exit(1)
|
::std::process::exit(1)
|
||||||
})
|
})
|
||||||
.unwrap() // exited above
|
.unwrap() // exited above
|
||||||
.starts_with(hash.as_ref())
|
.starts_with(hash.as_ref());
|
||||||
{
|
|
||||||
|
if id_starts_with_hash {
|
||||||
rt.report_touched(entry.get_location()).unwrap_or_exit();
|
rt.report_touched(entry.get_location()).unwrap_or_exit();
|
||||||
Some(entry)
|
true
|
||||||
} else {
|
} else {
|
||||||
None
|
false
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue