@@ -139,7 +139,6 @@ pub trait Utf8CStrBuf:
139139 // 3. All bytes from 0 to len is valid UTF-8 and does not contain null
140140 unsafe fn set_len ( & mut self , len : usize ) ;
141141 fn push_str ( & mut self , s : & str ) -> usize ;
142- fn push_lossy ( & mut self , s : & [ u8 ] ) -> usize ;
143142 // The capacity of the internal buffer. The maximum string length this buffer can contain
144143 // is capacity - 1, because the last byte is reserved for the terminating null character.
145144 fn capacity ( & self ) -> usize ;
@@ -199,17 +198,6 @@ fn utf8_cstr_append(buf: &mut dyn Utf8CStrBufWithSlice, s: &[u8]) -> usize {
199198 len
200199}
201200
202- fn utf8_cstr_append_lossy ( buf : & mut dyn Utf8CStrBuf , s : & [ u8 ] ) -> usize {
203- let mut len = 0_usize ;
204- for chunk in s. utf8_chunks ( ) {
205- len += buf. push_str ( chunk. valid ( ) ) ;
206- if !chunk. invalid ( ) . is_empty ( ) {
207- len += buf. push_str ( char:: REPLACEMENT_CHARACTER . encode_utf8 ( & mut [ 0 ; 4 ] ) ) ;
208- }
209- }
210- len
211- }
212-
213201pub trait StringExt {
214202 fn nul_terminate ( & mut self ) -> & mut [ u8 ] ;
215203}
@@ -300,11 +288,6 @@ impl Utf8CStrBuf for Utf8CString {
300288 s. len ( )
301289 }
302290
303- #[ inline( always) ]
304- fn push_lossy ( & mut self , s : & [ u8 ] ) -> usize {
305- utf8_cstr_append_lossy ( self , s)
306- }
307-
308291 fn capacity ( & self ) -> usize {
309292 self . 0 . capacity ( )
310293 }
@@ -790,10 +773,6 @@ macro_rules! impl_str_buf_with_slice {
790773 utf8_cstr_append( self , s. as_bytes( ) )
791774 }
792775 #[ inline( always) ]
793- fn push_lossy( & mut self , s: & [ u8 ] ) -> usize {
794- utf8_cstr_append_lossy( self , s)
795- }
796- #[ inline( always) ]
797776 fn capacity( & self ) -> usize {
798777 self . buf. len( )
799778 }
0 commit comments