From c1a5fe1d8e733d744a94acf278903133e2a72115 Mon Sep 17 00:00:00 2001
From: www-data <www-data@ek>
Date: Thu, 8 Aug 2019 10:34:55 +0200
Subject: [PATCH] Cleaning

---
 src/crypto.rs | 6 ++----
 src/main.rs   | 2 +-
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/src/crypto.rs b/src/crypto.rs
index f415fa1..a7aa5b9 100644
--- a/src/crypto.rs
+++ b/src/crypto.rs
@@ -43,10 +43,8 @@ pub fn encrypt(key: &str, plain_text: &str) -> Result<String, EncryptError> {
     let iv = rand::thread_rng().gen::<[u8; 16]>();
 
     let cipher_text =
-        match symm::encrypt(symm::Cipher::aes_128_cbc(), &key_as_bytes, Some(&iv), text_as_bytes) {
-            Ok(t) => t,
-            Err(_e) => return Err(EncryptError::UnableToEncrypt)
-        };
+        symm::encrypt(symm::Cipher::aes_128_cbc(), &key_as_bytes, Some(&iv), text_as_bytes)
+            .map_err(|_e| EncryptError::UnableToEncrypt)?;
 
     let hash_text = sha256(&text_as_bytes);
 
diff --git a/src/main.rs b/src/main.rs
index 6c9ab27..f1e66ee 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -53,10 +53,10 @@ struct Config {
 
 fn get_exe_name() -> String {
     let first_arg = std::env::args().nth(0).unwrap();
-    //dbg!(&first_arg);
     let sep: &[_] = &['\\', '/'];
     first_arg[first_arg.rfind(sep).unwrap()+1..].to_string()
 }
+
 fn read_key() -> String {
     let mut key = String::new();
     File::open(consts::FILE_KEY)
-- 
2.49.0