1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change 42
42
43
43
#![ stable( feature = "rust1" , since = "1.0.0" ) ]
44
44
45
- use core:: char:: MAX_LEN_UTF8 ;
46
45
use core:: error:: Error ;
47
46
use core:: fmt;
48
47
use core:: hash;
@@ -1346,7 +1345,9 @@ impl String {
1346
1345
pub fn push ( & mut self , ch : char ) {
1347
1346
match ch. len_utf8 ( ) {
1348
1347
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
+ }
1350
1351
}
1351
1352
}
1352
1353
@@ -1645,7 +1646,7 @@ impl String {
1645
1646
#[ rustc_confusables( "set" ) ]
1646
1647
pub fn insert ( & mut self , idx : usize , ch : char ) {
1647
1648
assert ! ( self . is_char_boundary( idx) ) ;
1648
- let mut bits = [ 0 ; MAX_LEN_UTF8 ] ;
1649
+ let mut bits = [ 0 ; char :: MAX_LEN_UTF8 ] ;
1649
1650
let bits = ch. encode_utf8 ( & mut bits) . as_bytes ( ) ;
1650
1651
1651
1652
unsafe {
@@ -2634,7 +2635,7 @@ impl ToString for core::ascii::Char {
2634
2635
impl ToString for char {
2635
2636
#[ inline]
2636
2637
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 ] ) )
2638
2639
}
2639
2640
}
2640
2641
0 commit comments