File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change 4242
4343#![ stable( feature = "rust1" , since = "1.0.0" ) ]
4444
45- use core:: char:: MAX_LEN_UTF8 ;
4645use core:: error:: Error ;
4746use core:: fmt;
4847use core:: hash;
@@ -1346,7 +1345,9 @@ impl String {
13461345 pub fn push ( & mut self , ch : char ) {
13471346 match ch. len_utf8 ( ) {
13481347 1 => self . vec . push ( ch as u8 ) ,
1349- _ => self . vec . extend_from_slice ( ch. encode_utf8 ( & mut [ 0 ; MAX_LEN_UTF8 ] ) . as_bytes ( ) ) ,
1348+ _ => {
1349+ self . vec . extend_from_slice ( ch. encode_utf8 ( & mut [ 0 ; char:: MAX_LEN_UTF8 ] ) . as_bytes ( ) )
1350+ }
13501351 }
13511352 }
13521353
@@ -1645,7 +1646,7 @@ impl String {
16451646 #[ rustc_confusables( "set" ) ]
16461647 pub fn insert ( & mut self , idx : usize , ch : char ) {
16471648 assert ! ( self . is_char_boundary( idx) ) ;
1648- let mut bits = [ 0 ; MAX_LEN_UTF8 ] ;
1649+ let mut bits = [ 0 ; char :: MAX_LEN_UTF8 ] ;
16491650 let bits = ch. encode_utf8 ( & mut bits) . as_bytes ( ) ;
16501651
16511652 unsafe {
@@ -2634,7 +2635,7 @@ impl ToString for core::ascii::Char {
26342635impl ToString for char {
26352636 #[ inline]
26362637 fn to_string ( & self ) -> String {
2637- String :: from ( self . encode_utf8 ( & mut [ 0 ; MAX_LEN_UTF8 ] ) )
2638+ String :: from ( self . encode_utf8 ( & mut [ 0 ; char :: MAX_LEN_UTF8 ] ) )
26382639 }
26392640}
26402641
You can’t perform that action at this time.
0 commit comments