[Auto] bin/core/bookmark: Fix Clippy warnings

Signed-off-by: flip1995 <hello@philkrones.com>
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This commit is contained in:
flip1995 2019-08-27 10:42:37 +02:00 committed by Matthias Beyer
parent 3a32be23c5
commit 3963e5ec2d

View file

@ -105,13 +105,13 @@ fn add(rt: &Runtime) {
.ok_or_else(|| format_err!("No bookmark collection '{}' found", coll)) .ok_or_else(|| format_err!("No bookmark collection '{}' found", coll))
.map_err_trace_exit_unwrap(); .map_err_trace_exit_unwrap();
let _ = rt.report_touched(collection.get_location()).unwrap_or_exit(); rt.report_touched(collection.get_location()).unwrap_or_exit();
for url in scmd.values_of("urls").unwrap() { // unwrap saved by clap for url in scmd.values_of("urls").unwrap() { // unwrap saved by clap
let new_ids = BookmarkCollection::add_link(collection.deref_mut(), rt.store(), BookmarkLink::from(url)) let new_ids = BookmarkCollection::add_link(collection.deref_mut(), rt.store(), BookmarkLink::from(url))
.map_err_trace_exit_unwrap(); .map_err_trace_exit_unwrap();
let _ = rt.report_all_touched(new_ids.into_iter()).unwrap_or_exit(); rt.report_all_touched(new_ids.into_iter()).unwrap_or_exit();
} }
info!("Ready"); info!("Ready");
@ -123,7 +123,7 @@ fn collection(rt: &Runtime) {
if scmd.is_present("add") { // adding a new collection if scmd.is_present("add") { // adding a new collection
let name = scmd.value_of("add").unwrap(); let name = scmd.value_of("add").unwrap();
if let Ok(id) = BookmarkCollectionStore::new(rt.store(), &name) { if let Ok(id) = BookmarkCollectionStore::new(rt.store(), &name) {
let _ = rt.report_touched(id.get_location()).unwrap_or_exit(); rt.report_touched(id.get_location()).unwrap_or_exit();
info!("Created: {}", name); info!("Created: {}", name);
} else { } else {
warn!("Creating collection {} failed", name); warn!("Creating collection {} failed", name);
@ -135,7 +135,7 @@ fn collection(rt: &Runtime) {
let name = scmd.value_of("remove").unwrap(); let name = scmd.value_of("remove").unwrap();
{ // remove all links { // remove all links
let _ = BookmarkCollectionStore::get(rt.store(), &name) BookmarkCollectionStore::get(rt.store(), &name)
.map_err_trace_exit_unwrap() .map_err_trace_exit_unwrap()
.ok_or_else(|| format_err!("Collection does not exist: {}", name)) .ok_or_else(|| format_err!("Collection does not exist: {}", name))
.map_err_trace_exit_unwrap() .map_err_trace_exit_unwrap()
@ -160,13 +160,12 @@ fn list(rt: &Runtime) {
.ok_or_else(|| format_err!("No bookmark collection '{}' found", coll)) .ok_or_else(|| format_err!("No bookmark collection '{}' found", coll))
.map_err_trace_exit_unwrap(); .map_err_trace_exit_unwrap();
let _ = rt.report_touched(collection.get_location()).unwrap_or_exit(); rt.report_touched(collection.get_location()).unwrap_or_exit();
collection collection
.get_links(rt.store()) .get_links(rt.store())
.map_dbg_str("Listing...") .map_dbg_str("Listing...")
.map_err_trace_exit_unwrap() .map_err_trace_exit_unwrap()
.into_iter()
.enumerate() .enumerate()
.for_each(|(i, link)| match link { .for_each(|(i, link)| match link {
Ok(link) => writeln!(rt.stdout(), "{: >3}: {}", i, link).to_exit_code().unwrap_or_exit(), Ok(link) => writeln!(rt.stdout(), "{: >3}: {}", i, link).to_exit_code().unwrap_or_exit(),
@ -184,13 +183,13 @@ fn remove(rt: &Runtime) {
.ok_or_else(|| format_err!("No bookmark collection '{}' found", coll)) .ok_or_else(|| format_err!("No bookmark collection '{}' found", coll))
.map_err_trace_exit_unwrap(); .map_err_trace_exit_unwrap();
let _ = rt.report_touched(collection.get_location()).unwrap_or_exit(); rt.report_touched(collection.get_location()).unwrap_or_exit();
for url in scmd.values_of("urls").unwrap() { // enforced by clap for url in scmd.values_of("urls").unwrap() { // enforced by clap
let removed_links = BookmarkCollection::remove_link(collection.deref_mut(), rt.store(), BookmarkLink::from(url)) let removed_links = BookmarkCollection::remove_link(collection.deref_mut(), rt.store(), BookmarkLink::from(url))
.map_err_trace_exit_unwrap(); .map_err_trace_exit_unwrap();
let _ = rt.report_all_touched(removed_links.into_iter()).unwrap_or_exit(); rt.report_all_touched(removed_links.into_iter()).unwrap_or_exit();
} }
info!("Ready"); info!("Ready");