From 5c1446df00b1ab20ef6f8726d07972c06f03ccad Mon Sep 17 00:00:00 2001 From: Michael Pfaff Date: Thu, 3 Mar 2022 07:46:12 -0500 Subject: [PATCH] Replace cfg!(debug_assertions) with debug_assert! --- src/util.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/util.rs b/src/util.rs index 9c834a8..3e65e14 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, "atou16 accepts up to 4 bytes"); if bytes.len() == 0 { return Err(Error::InvalidFormat("Not a number")); }