From 3d6b29bca4a3576f5da8956c7be23fea8977870c Mon Sep 17 00:00:00 2001
From: librelois <elois@ifee.fr>
Date: Tue, 16 Apr 2019 23:19:04 +0200
Subject: [PATCH] [fix] crypto: remove all unwrap() and deny it

---
 lib/tools/crypto/src/bases/b16.rs | 4 ++--
 lib/tools/crypto/src/lib.rs       | 1 +
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/lib/tools/crypto/src/bases/b16.rs b/lib/tools/crypto/src/bases/b16.rs
index 222406cf..7e687e35 100644
--- a/lib/tools/crypto/src/bases/b16.rs
+++ b/lib/tools/crypto/src/bases/b16.rs
@@ -52,8 +52,8 @@ pub fn str_hex_to_32bytes(text: &str) -> Result<[u8; 32], BaseConvertionError> {
                 });
             }
 
-            let byte1 = byte1.unwrap() as u8;
-            let byte2 = byte2.unwrap() as u8;
+            let byte1 = byte1.unwrap_or_else(|| panic!(dbg!("dev error"))) as u8;
+            let byte2 = byte2.unwrap_or_else(|| panic!(dbg!("dev error"))) as u8;
 
             let byte = (byte1 << 4) | byte2;
             bytes[i / 2] = byte;
diff --git a/lib/tools/crypto/src/lib.rs b/lib/tools/crypto/src/lib.rs
index a7515d23..8fde77e8 100644
--- a/lib/tools/crypto/src/lib.rs
+++ b/lib/tools/crypto/src/lib.rs
@@ -15,6 +15,7 @@
 
 //! Manage cryptographic operations for the DUP (DUniter Protocol).
 
+#![deny(clippy::option_unwrap_used, clippy::result_unwrap_used)]
 #![deny(
     missing_docs,
     missing_debug_implementations,
-- 
GitLab