@@ -291,7 +291,7 @@ fn format_string(value: &str, dst: &mut [u8]) -> usize {
291291 {
292292 let has_neon = cfg ! ( target_os = "macos" ) || std:: arch:: is_aarch64_feature_detected!( "neon" ) ;
293293 if has_neon {
294- unsafe { simd:: neon:: format_string ( value, dst) }
294+ simd:: neon:: format_string ( value, dst)
295295 } else {
296296 simd:: v128:: format_string ( value, dst)
297297 }
@@ -302,13 +302,13 @@ fn format_string(value: &str, dst: &mut [u8]) -> usize {
302302 #[ cfg( feature = "avx512" ) ]
303303 {
304304 if is_x86_feature_detected ! ( "avx512f" ) {
305- return unsafe { simd:: avx512:: format_string ( value, dst) } ;
305+ return simd:: avx512:: format_string ( value, dst) ;
306306 }
307307 }
308308 if is_x86_feature_detected ! ( "avx2" ) {
309- unsafe { simd:: avx2:: format_string ( value, dst) }
309+ simd:: avx2:: format_string ( value, dst)
310310 } else if is_x86_feature_detected ! ( "sse2" ) {
311- unsafe { simd:: sse2:: format_string ( value, dst) }
311+ simd:: sse2:: format_string ( value, dst)
312312 } else {
313313 simd:: v128:: format_string ( value, dst)
314314 }
@@ -326,9 +326,9 @@ fn format_unquoted(value: &str, dst: &mut [u8]) -> usize {
326326 {
327327 let has_neon = cfg ! ( target_os = "macos" ) || std:: arch:: is_aarch64_feature_detected!( "neon" ) ;
328328 if has_neon {
329- unsafe { simd:: neon:: format_unquoted ( value, dst) }
329+ simd:: neon:: format_unquoted ( value, dst)
330330 } else {
331- simd:: v128:: format_string ( value, dst)
331+ simd:: v128:: format_unquoted ( value, dst)
332332 }
333333 }
334334
@@ -337,21 +337,21 @@ fn format_unquoted(value: &str, dst: &mut [u8]) -> usize {
337337 #[ cfg( feature = "avx512" ) ]
338338 {
339339 if is_x86_feature_detected ! ( "avx512f" ) {
340- return unsafe { simd:: avx512:: format_unquote ( value, dst) } ;
340+ return simd:: avx512:: format_unquoted ( value, dst) ;
341341 }
342342 }
343343 if is_x86_feature_detected ! ( "avx2" ) {
344- unsafe { simd:: avx2:: format_unquoted ( value, dst) }
344+ simd:: avx2:: format_unquoted ( value, dst)
345345 } else if is_x86_feature_detected ! ( "sse2" ) {
346- unsafe { simd:: sse2:: format_unquoted ( value, dst) }
346+ simd:: sse2:: format_unquoted ( value, dst)
347347 } else {
348348 simd:: v128:: format_unquoted ( value, dst)
349349 }
350350 }
351351
352352 #[ cfg( not( any( target_arch = "aarch64" , target_arch = "x86" , target_arch = "x86_64" ) ) ) ]
353353 {
354- simd:: v128:: format_string ( value, dst)
354+ simd:: v128:: format_unquoted ( value, dst)
355355 }
356356}
357357
@@ -382,7 +382,7 @@ pub fn escape_unquote(value: &str) -> String {
382382/// # Panics
383383///
384384/// Panics if the buffer is not large enough. Allocate enough capacity for dst,
385- /// x6 will be enough in the worst case.
385+ /// x6 + 2 will be enough in the worst case.
386386pub fn escape_into < S : AsRef < str > > ( value : S , dst : & mut Vec < u8 > ) {
387387 let value = value. as_ref ( ) ;
388388 let old_len = dst. len ( ) ;
0 commit comments