diff --git a/native/src/base/cstr.rs b/native/src/base/cstr.rs index e3025335d..99e2ab1b6 100644 --- a/native/src/base/cstr.rs +++ b/native/src/base/cstr.rs @@ -139,7 +139,6 @@ pub trait Utf8CStrBuf: // 3. All bytes from 0 to len is valid UTF-8 and does not contain null unsafe fn set_len(&mut self, len: usize); fn push_str(&mut self, s: &str) -> usize; - fn push_lossy(&mut self, s: &[u8]) -> usize; // The capacity of the internal buffer. The maximum string length this buffer can contain // is capacity - 1, because the last byte is reserved for the terminating null character. fn capacity(&self) -> usize; @@ -199,17 +198,6 @@ fn utf8_cstr_append(buf: &mut dyn Utf8CStrBufWithSlice, s: &[u8]) -> usize { len } -fn utf8_cstr_append_lossy(buf: &mut dyn Utf8CStrBuf, s: &[u8]) -> usize { - let mut len = 0_usize; - for chunk in s.utf8_chunks() { - len += buf.push_str(chunk.valid()); - if !chunk.invalid().is_empty() { - len += buf.push_str(char::REPLACEMENT_CHARACTER.encode_utf8(&mut [0; 4])); - } - } - len -} - pub trait StringExt { fn nul_terminate(&mut self) -> &mut [u8]; } @@ -300,11 +288,6 @@ impl Utf8CStrBuf for Utf8CString { s.len() } - #[inline(always)] - fn push_lossy(&mut self, s: &[u8]) -> usize { - utf8_cstr_append_lossy(self, s) - } - fn capacity(&self) -> usize { self.0.capacity() } @@ -790,10 +773,6 @@ macro_rules! impl_str_buf_with_slice { utf8_cstr_append(self, s.as_bytes()) } #[inline(always)] - fn push_lossy(&mut self, s: &[u8]) -> usize { - utf8_cstr_append_lossy(self, s) - } - #[inline(always)] fn capacity(&self) -> usize { self.buf.len() }