File tree Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -899,7 +899,7 @@ impl<'de, R: Read<'de>> Deserializer<R> {
899
899
fn scan_number ( & mut self , buf : & mut String ) -> Result < ( ) > {
900
900
match tri ! ( self . peek_or_null( ) ) {
901
901
b'.' => self . scan_decimal ( buf) ,
902
- b'e' | b'E' => self . scan_exponent ( buf) ,
902
+ c @ ( b'e' | b'E' ) => self . scan_exponent ( c as char , buf) ,
903
903
_ => Ok ( ( ) ) ,
904
904
}
905
905
}
@@ -924,19 +924,20 @@ impl<'de, R: Read<'de>> Deserializer<R> {
924
924
}
925
925
926
926
match tri ! ( self . peek_or_null( ) ) {
927
- b'e' | b'E' => self . scan_exponent ( buf) ,
927
+ c @ ( b'e' | b'E' ) => self . scan_exponent ( c as char , buf) ,
928
928
_ => Ok ( ( ) ) ,
929
929
}
930
930
}
931
931
932
932
#[ cfg( feature = "arbitrary_precision" ) ]
933
- fn scan_exponent ( & mut self , buf : & mut String ) -> Result < ( ) > {
933
+ fn scan_exponent ( & mut self , e : char , buf : & mut String ) -> Result < ( ) > {
934
934
self . eat_char ( ) ;
935
- buf. push ( 'e' ) ;
935
+ buf. push ( e ) ;
936
936
937
937
match tri ! ( self . peek_or_null( ) ) {
938
938
b'+' => {
939
939
self . eat_char ( ) ;
940
+ buf. push ( '+' ) ;
940
941
}
941
942
b'-' => {
942
943
self . eat_char ( ) ;
Original file line number Diff line number Diff line change @@ -1007,8 +1007,14 @@ fn test_parse_number() {
1007
1007
#[ cfg( feature = "arbitrary_precision" ) ]
1008
1008
test_parse_ok ( vec ! [
1009
1009
( "1e999" , Number :: from_string_unchecked( "1e999" . to_owned( ) ) ) ,
1010
+ ( "1e+999" , Number :: from_string_unchecked( "1e+999" . to_owned( ) ) ) ,
1010
1011
( "-1e999" , Number :: from_string_unchecked( "-1e999" . to_owned( ) ) ) ,
1011
1012
( "1e-999" , Number :: from_string_unchecked( "1e-999" . to_owned( ) ) ) ,
1013
+ ( "1E999" , Number :: from_string_unchecked( "1E999" . to_owned( ) ) ) ,
1014
+ ( "1E+999" , Number :: from_string_unchecked( "1E+999" . to_owned( ) ) ) ,
1015
+ ( "-1E999" , Number :: from_string_unchecked( "-1E999" . to_owned( ) ) ) ,
1016
+ ( "1E-999" , Number :: from_string_unchecked( "1E-999" . to_owned( ) ) ) ,
1017
+ ( "1E+000" , Number :: from_string_unchecked( "1E+000" . to_owned( ) ) ) ,
1012
1018
(
1013
1019
"2.3e999" ,
1014
1020
Number :: from_string_unchecked( "2.3e999" . to_owned( ) ) ,
You can’t perform that action at this time.
0 commit comments