Remove debug assertions

This commit is contained in:
Yota Toyama 2025-04-10 15:46:05 -07:00
parent b2d201167c
commit f9616cf5bb

View File

@ -119,8 +119,6 @@ impl<const N: usize> CString<N> {
/// Converts the [`CString`] to a [`CStr`] slice.
#[inline]
pub fn as_c_str(&self) -> &CStr {
debug_assert!(CStr::from_bytes_with_nul(&self.inner).is_ok());
unsafe { CStr::from_bytes_with_nul_unchecked(&self.inner) }
}
@ -261,8 +259,6 @@ impl<const N: usize> CString<N> {
/// ```
#[inline]
pub fn as_bytes(&self) -> &[u8] {
debug_assert_eq!(self.inner.last().copied(), Some(0));
&self.inner[..self.inner.len() - 1]
}
}