@@ -7,8 +7,8 @@ use core::str::{
77
88pub use self :: string_errors:: StringError ;
99use self :: string_utils:: {
10- encode_char_utf8_unchecked, is_char_boundary, is_inside_boundary, never, shift_left_unchecked ,
11- shift_right_unchecked , str_is_char_boundary , truncate_str,
10+ encode_char_utf8_unchecked, is_char_boundary, is_inside_boundary, never, str_is_char_boundary ,
11+ truncate_str,
1212} ;
1313use crate :: errors:: CapacityError ;
1414use crate :: StaticVec ;
@@ -783,7 +783,7 @@ impl<const N: usize> StaticString<N> {
783783 }
784784 }
785785 unsafe {
786- shift_left_unchecked ( self , start, 0usize ) ;
786+ shift_left_unchecked ! ( self , start, 0usize ) ;
787787 self . vec . set_len ( end - start)
788788 } ;
789789 }
@@ -811,7 +811,7 @@ impl<const N: usize> StaticString<N> {
811811 let character = character. unwrap_or_else ( || unsafe { never ( "Missing char" ) } ) ;
812812 let char_length = character. len_utf8 ( ) ;
813813 unsafe {
814- shift_left_unchecked ( self , index + char_length, index) ;
814+ shift_left_unchecked ! ( self , index + char_length, index) ;
815815 self . vec . set_len ( old_length - char_length) ;
816816 }
817817 character
@@ -922,7 +922,7 @@ impl<const N: usize> StaticString<N> {
922922 #[ inline( always) ]
923923 pub unsafe fn insert_unchecked ( & mut self , index : usize , character : char ) {
924924 let char_length = character. len_utf8 ( ) ;
925- shift_right_unchecked ( self , index, index + char_length) ;
925+ shift_right_unchecked ! ( self , index, index + char_length) ;
926926 encode_char_utf8_unchecked ( self , character, index) ;
927927 }
928928
@@ -1010,7 +1010,7 @@ impl<const N: usize> StaticString<N> {
10101010 let string_length = string_ref. len ( ) ;
10111011 debug_assert ! ( string_length <= self . remaining_capacity( ) ) ;
10121012 let string_ptr = string_ref. as_ptr ( ) ;
1013- shift_right_unchecked ( self , index, index + string_length) ;
1013+ shift_right_unchecked ! ( self , index, index + string_length) ;
10141014 string_ptr. copy_to_nonoverlapping ( self . vec . mut_ptr_at_unchecked ( index) , string_length) ;
10151015 self . vec . set_len ( self . len ( ) + string_length) ;
10161016 }
@@ -1213,17 +1213,20 @@ impl<const N: usize> StaticString<N> {
12131213 ) ;
12141214 if replace_length == 0 {
12151215 unsafe {
1216- self
1217- . as_ptr ( )
1218- . add ( end)
1219- . copy_to ( self . as_mut_ptr ( ) . add ( start) , old_length. saturating_sub ( end) ) ;
1216+ let mp = self . vec . as_mut_ptr ( ) ;
1217+ mp. add ( end)
1218+ . copy_to ( mp. add ( start) , old_length. saturating_sub ( end) ) ;
12201219 self . vec . set_len ( old_length. saturating_sub ( replaced) ) ;
12211220 }
12221221 } else {
12231222 if start + replace_length > end {
1224- unsafe { shift_right_unchecked ( self , end, start + replace_length) } ;
1223+ unsafe {
1224+ shift_right_unchecked ! ( self , end, start + replace_length) ;
1225+ }
12251226 } else {
1226- unsafe { shift_left_unchecked ( self , end, start + replace_length) } ;
1227+ unsafe {
1228+ shift_left_unchecked ! ( self , end, start + replace_length) ;
1229+ }
12271230 }
12281231 let ptr = replace_with. as_ptr ( ) ;
12291232 let dest = unsafe { self . vec . as_mut_ptr ( ) . add ( start) } ;
0 commit comments