From bf623eed7fc6d7184f2b794461d0d37a03731d5d Mon Sep 17 00:00:00 2001 From: Yip Rui Fung Date: Sat, 9 Jul 2022 11:41:53 +0800 Subject: [PATCH] Use if let instead of a match with empty block. --- src/api/core/ciphers.rs | 5 ++--- src/api/core/sends.rs | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/api/core/ciphers.rs b/src/api/core/ciphers.rs index 7459bba0..137242b0 100644 --- a/src/api/core/ciphers.rs +++ b/src/api/core/ciphers.rs @@ -999,9 +999,8 @@ async fn save_attachment( attachment.save(&conn).await.expect("Error saving attachment"); } - match data.data.persist_to(&file_path).await { - Ok(_result) => {} - Err(_error) => data.data.move_copy_to(&file_path).await?, + if let Err(_err) = data.data.persist_to(&file_path).await { + data.data.move_copy_to(file_path).await? } nt.send_cipher_update(UpdateType::CipherUpdate, &cipher, &cipher.update_users_revision(&conn).await).await; diff --git a/src/api/core/sends.rs b/src/api/core/sends.rs index b5ba15d0..4012fd82 100644 --- a/src/api/core/sends.rs +++ b/src/api/core/sends.rs @@ -226,9 +226,8 @@ async fn post_send_file(data: Form>, headers: Headers, conn: DbCo let file_path = folder_path.join(&file_id); tokio::fs::create_dir_all(&folder_path).await?; - match data.persist_to(&file_path).await { - Ok(_result) => {} - Err(_error) => data.move_copy_to(&file_path).await?, + if let Err(_err) = data.persist_to(&file_path).await { + data.move_copy_to(file_path).await? } let mut data_value: Value = serde_json::from_str(&send.data)?;