From 3b537f70ac4713a7c689dc568777956d4d2dd2a2 Mon Sep 17 00:00:00 2001 From: Miroslav Prasil Date: Tue, 15 May 2018 13:57:00 +0100 Subject: [PATCH] Remove unnecessary test and rewrite match --- src/api/core/ciphers.rs | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/api/core/ciphers.rs b/src/api/core/ciphers.rs index 5be036ab..d5309c4f 100644 --- a/src/api/core/ciphers.rs +++ b/src/api/core/ciphers.rs @@ -352,15 +352,12 @@ fn post_cipher_share(uuid: String, data: Json, headers: Headers let data: ShareCipherData = data.into_inner(); let mut cipher = match Cipher::find_by_uuid(&uuid, &conn) { - Some(cipher) => match cipher.uuid == uuid { - true => { - if cipher.is_write_accessible_to_user(&headers.user.uuid, &conn) { - cipher - } else { - err!("Cipher is not write accessible") - } - }, - false => err!("Wrong Cipher id provided") + Some(cipher) => { + if cipher.is_write_accessible_to_user(&headers.user.uuid, &conn) { + cipher + } else { + err!("Cipher is not write accessible") + } }, None => err!("Cipher doesn't exist") };