From 4d27f3f5b99ccf5fe7dc159a765e8c39b41fd73e Mon Sep 17 00:00:00 2001 From: Nora Widdecke Date: Fri, 18 Feb 2022 14:12:55 +0100 Subject: [PATCH] lint: fix clippy::single_match --- database/src/fs.rs | 18 ++++++------------ src/web/vks_web.rs | 19 ++++++++----------- 2 files changed, 14 insertions(+), 23 deletions(-) diff --git a/database/src/fs.rs b/database/src/fs.rs index 9bb9486..7ea818f 100644 --- a/database/src/fs.rs +++ b/database/src/fs.rs @@ -529,21 +529,15 @@ impl Database for Filesystem { let expected = diff_paths(&self.fingerprint_to_path_published(primary_fpr), link_fpr.parent().unwrap()).unwrap(); - match read_link(&link_fpr) { - Ok(target) => { - if target == expected { - remove_file(&link_fpr)?; - } + if let Ok(target) = read_link(&link_fpr) { + if target == expected { + remove_file(&link_fpr)?; } - Err(_) => {} } - match read_link(&link_keyid) { - Ok(target) => { - if target == expected { - remove_file(link_keyid)?; - } + if let Ok(target) = read_link(&link_keyid) { + if target == expected { + remove_file(link_keyid)?; } - Err(_) => {} } Ok(()) diff --git a/src/web/vks_web.rs b/src/web/vks_web.rs index 24bf34b..3856433 100644 --- a/src/web/vks_web.rs +++ b/src/web/vks_web.rs @@ -346,17 +346,14 @@ pub async fn process_post_form( not valid")) })?; - match name.to_string().as_str() { - "keytext" => { - return Ok(vks::process_key( - db, - i18n, - tokens_stateless, - rate_limiter, - Cursor::new(decoded_value.as_bytes()) - )); - } - _ => { /* skip */ } + if name.to_string().as_str() == "keytext" { + return Ok(vks::process_key( + db, + i18n, + tokens_stateless, + rate_limiter, + Cursor::new(decoded_value.as_bytes()) + )); } }