commit 3b537f70ac4713a7c689dc568777956d4d2dd2a2
parent f43d329e2223919d98586f3a1d06881c5a14ffeb
Author: Miroslav Prasil <miroslav@prasil.info>
Date: Tue, 15 May 2018 13:57:00 +0100
Remove unnecessary test and rewrite match
Diffstat:
1 file changed, 6 insertions(+), 9 deletions(-)
diff --git a/src/api/core/ciphers.rs b/src/api/core/ciphers.rs
@@ -352,15 +352,12 @@ fn post_cipher_share(uuid: String, data: Json<ShareCipherData>, 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")
};