File tree Expand file tree Collapse file tree 3 files changed +12
-10
lines changed Expand file tree Collapse file tree 3 files changed +12
-10
lines changed Original file line number Diff line number Diff line change @@ -864,6 +864,15 @@ impl<'de, R: Read<'de>> Deserializer<R> {
864864            buf. push ( '-' ) ; 
865865        } 
866866        self . scan_integer ( & mut  buf) ?; 
867+         if  positive { 
868+             if  let  Ok ( unsigned)  = buf. parse ( )  { 
869+                 return  Ok ( ParserNumber :: U64 ( unsigned) ) ; 
870+             } 
871+         }  else  { 
872+             if  let  Ok ( signed)  = buf. parse ( )  { 
873+                 return  Ok ( ParserNumber :: I64 ( signed) ) ; 
874+             } 
875+         } 
867876        Ok ( ParserNumber :: String ( buf) ) 
868877    } 
869878
Original file line number Diff line number Diff line change 303303#![ doc( html_root_url = "https://docs.rs/serde_json/1.0.74" ) ]  
304304// Ignored clippy lints 
305305#![ allow(  
306+     clippy:: collapsible_else_if,  
306307    clippy:: comparison_chain,  
307308    clippy:: deprecated_cfg_attr,  
308309    clippy:: doc_markdown,  
Original file line number Diff line number Diff line change @@ -715,11 +715,7 @@ fn test_parse_char() {
715715        ) , 
716716        ( 
717717            "10" , 
718-             if  cfg ! ( feature = "arbitrary_precision" )  { 
719-                 "invalid type: number, expected a character at line 1 column 2" 
720-             }  else  { 
721-                 "invalid type: integer `10`, expected a character at line 1 column 2" 
722-             } , 
718+             "invalid type: integer `10`, expected a character at line 1 column 2" , 
723719        ) , 
724720    ] ) ; 
725721
@@ -1203,11 +1199,7 @@ fn test_parse_struct() {
12031199    test_parse_err :: < Outer > ( & [ 
12041200        ( 
12051201            "5" , 
1206-             if  cfg ! ( feature = "arbitrary_precision" )  { 
1207-                 "invalid type: number, expected struct Outer at line 1 column 1" 
1208-             }  else  { 
1209-                 "invalid type: integer `5`, expected struct Outer at line 1 column 1" 
1210-             } , 
1202+             "invalid type: integer `5`, expected struct Outer at line 1 column 1" , 
12111203        ) , 
12121204        ( 
12131205            "\" hello\" " , 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments