From 42f6a3040d2f040bce9b518821cbd2dfe8c5388a Mon Sep 17 00:00:00 2001 From: flip1995 Date: Tue, 27 Aug 2019 10:32:30 +0200 Subject: [PATCH] [No-auto] bin/core/tag: Fix Clippy warnings Signed-off-by: flip1995 Signed-off-by: Matthias Beyer --- bin/core/imag-tag/src/main.rs | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/bin/core/imag-tag/src/main.rs b/bin/core/imag-tag/src/main.rs index a3c1bdc3..30eb37e2 100644 --- a/bin/core/imag-tag/src/main.rs +++ b/bin/core/imag-tag/src/main.rs @@ -93,9 +93,8 @@ fn main() { }) .into_iter(); - rt.cli() - .subcommand_name() - .map(|name| match name { + if let Some(name) = rt.cli().subcommand_name() { + match name { "list" => for id in ids { list(id, &rt) }, @@ -118,7 +117,8 @@ fn main() { .code() .map(::std::process::exit); }, - }); + } + } } fn alter(rt: &Runtime, path: StoreId, add: Option>, rem: Option>) { @@ -126,21 +126,21 @@ fn alter(rt: &Runtime, path: StoreId, add: Option>, rem: Option { debug!("Entry header now = {:?}", e.get_header()); - add.map(|tags| { - debug!("Adding tags = '{:?}'", tags); - for tag in tags { - debug!("Adding tag '{:?}'", tag); - if let Err(e) = e.add_tag(tag) { - trace_error(&e); - } else { - debug!("Adding tag worked"); - } + if let Some(tags) = add { + debug!("Adding tags = '{:?}'", tags); + for tag in tags { + debug!("Adding tag '{:?}'", tag); + if let Err(e) = e.add_tag(tag) { + trace_error(&e); + } else { + debug!("Adding tag worked"); } - }); // it is okay to ignore a None here + } + } // it is okay to ignore a None here debug!("Entry header now = {:?}", e.get_header()); - rem.map(|tags| { + if let Some(tags) = rem { debug!("Removing tags = '{:?}'", tags); for tag in tags { debug!("Removing tag '{:?}'", tag); @@ -148,7 +148,7 @@ fn alter(rt: &Runtime, path: StoreId, add: Option>, rem: Option>(tags: I) -> Value { + fn tags_toml_value>(tags: I) -> Value { Value::Array(tags.into_iter().map(|s| Value::String(s.to_owned())).collect()) }