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 @@ -898,7 +898,7 @@ impl<'de, R: Read<'de>> Deserializer<R> {
898
898
fn scan_number ( & mut self , buf : & mut String ) -> Result < ( ) > {
899
899
match tri ! ( self . peek_or_null( ) ) {
900
900
b'.' => self . scan_decimal ( buf) ,
901
- b'e' | b'E' => self . scan_exponent ( buf) ,
901
+ c @ ( b'e' | b'E' ) => self . scan_exponent ( c as char , buf) ,
902
902
_ => Ok ( ( ) ) ,
903
903
}
904
904
}
@@ -923,19 +923,20 @@ impl<'de, R: Read<'de>> Deserializer<R> {
923
923
}
924
924
925
925
match tri ! ( self . peek_or_null( ) ) {
926
- b'e' | b'E' => self . scan_exponent ( buf) ,
926
+ c @ ( b'e' | b'E' ) => self . scan_exponent ( c as char , buf) ,
927
927
_ => Ok ( ( ) ) ,
928
928
}
929
929
}
930
930
931
931
#[ cfg( feature = "arbitrary_precision" ) ]
932
- fn scan_exponent ( & mut self , buf : & mut String ) -> Result < ( ) > {
932
+ fn scan_exponent ( & mut self , e : char , buf : & mut String ) -> Result < ( ) > {
933
933
self . eat_char ( ) ;
934
- buf. push ( 'e' ) ;
934
+ buf. push ( e ) ;
935
935
936
936
match tri ! ( self . peek_or_null( ) ) {
937
937
b'+' => {
938
938
self . eat_char ( ) ;
939
+ buf. push ( '+' ) ;
939
940
}
940
941
b'-' => {
941
942
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