File tree Expand file tree Collapse file tree 2 files changed +4
-19
lines changed Expand file tree Collapse file tree 2 files changed +4
-19
lines changed Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ hashbrown = "0.9"
20
20
lazy_static = " 1.4.0"
21
21
regex = " 1.3"
22
22
regex-syntax = " 0.6.22"
23
- itoa = " 0.4 "
23
+ itoa = " 1.0 "
24
24
ryu = " 1.0"
25
25
libc = " 0.2"
26
26
jemallocator = { version = " 0.3" , optional = true }
Original file line number Diff line number Diff line change @@ -93,18 +93,6 @@ impl Inline {
93
93
)
94
94
}
95
95
}
96
-
97
- #[ inline( always) ]
98
- fn itoa ( i : Int ) -> Option < Inline > {
99
- if i > 999999999999999 || i < -99999999999999 {
100
- return None ;
101
- }
102
- let mut res = 0u128 ;
103
- let buf =
104
- unsafe { slice:: from_raw_parts_mut ( ( & mut res as * mut _ as * mut u8 ) . offset ( 1 ) , 15 ) } ;
105
- let len = itoa:: write ( buf, i) . unwrap ( ) ;
106
- Some ( Inline ( res | ( ( len << 3 ) | StrTag :: Inline as usize ) as u128 ) )
107
- }
108
96
}
109
97
110
98
#[ derive( Clone ) ]
@@ -926,12 +914,9 @@ impl<'a> From<String> for Str<'a> {
926
914
927
915
impl < ' a > From < Int > for Str < ' a > {
928
916
fn from ( i : Int ) -> Str < ' a > {
929
- if let Some ( i) = Inline :: itoa ( i) {
930
- return Str :: from_rep ( i. into ( ) ) ;
931
- }
932
- let mut buf = [ 0u8 ; 21 ] ;
933
- let n = itoa:: write ( & mut buf[ ..] , i) . unwrap ( ) ;
934
- Buf :: read_from_bytes ( & buf[ ..n] ) . into_str ( )
917
+ let mut itoabuf = itoa:: Buffer :: new ( ) ;
918
+ let s = itoabuf. format ( i) ;
919
+ Buf :: read_from_bytes ( & s. as_bytes ( ) ) . into_str ( )
935
920
}
936
921
}
937
922
You can’t perform that action at this time.
0 commit comments