From 86eaa73be07a716b26e6f9c345466f75772059b3 Mon Sep 17 00:00:00 2001 From: KAMADA Ken'ichi Date: Mon, 18 Oct 2021 23:48:40 +0900 Subject: [PATCH] Simply use debug_assert!() instead of cfg!(debug_assertions). --- src/util.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/util.rs b/src/util.rs index 9c834a8..2da8ba0 100644 --- a/src/util.rs +++ b/src/util.rs @@ -105,9 +105,7 @@ impl ReadExt for T where T: io::Read { // This function must not be called with more than 4 bytes. pub fn atou16(bytes: &[u8]) -> Result { - if cfg!(debug_assertions) && bytes.len() >= 5 { - panic!("atou16 accepts up to 4 bytes"); - } + debug_assert!(bytes.len() <= 4); if bytes.len() == 0 { return Err(Error::InvalidFormat("Not a number")); }