From 7a97c0258469983cf97a7f4a0eef7119854ad305 Mon Sep 17 00:00:00 2001 From: flip1995 Date: Tue, 27 Aug 2019 10:32:52 +0200 Subject: [PATCH] [No-auto] bin/domain/bookmark: Fix Clippy warnings Signed-off-by: flip1995 Signed-off-by: Matthias Beyer --- bin/domain/imag-bookmark/src/main.rs | 36 +++++++++++++--------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/bin/domain/imag-bookmark/src/main.rs b/bin/domain/imag-bookmark/src/main.rs index 2f0eb5e0..a932f381 100644 --- a/bin/domain/imag-bookmark/src/main.rs +++ b/bin/domain/imag-bookmark/src/main.rs @@ -76,24 +76,22 @@ fn main() { "Bookmark collection tool", build_ui); - rt.cli() - .subcommand_name() - .map(|name| { - debug!("Call {}", name); - match name { - "add" => add(&rt), - "collection" => collection(&rt), - "list" => list(&rt), - "remove" => remove(&rt), - other => { - debug!("Unknown command"); - let _ = rt.handle_unknown_subcommand("imag-bookmark", other, rt.cli()) - .map_err_trace_exit_unwrap() - .code() - .map(::std::process::exit); - }, - } - }); + if let Some(name) = rt.cli().subcommand_name() { + debug!("Call {}", name); + match name { + "add" => add(&rt), + "collection" => collection(&rt), + "list" => list(&rt), + "remove" => remove(&rt), + other => { + debug!("Unknown command"); + let _ = rt.handle_unknown_subcommand("imag-bookmark", other, rt.cli()) + .map_err_trace_exit_unwrap() + .code() + .map(::std::process::exit); + }, + } + } } fn add(rt: &Runtime) { @@ -143,7 +141,7 @@ fn collection(rt: &Runtime) { .map_err_trace_exit_unwrap(); } - if let Ok(_) = BookmarkCollectionStore::delete(rt.store(), &name) { + if BookmarkCollectionStore::delete(rt.store(), &name).is_ok() { info!("Deleted: {}", name); } else { warn!("Deleting collection {} failed", name);