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> {
864
864
buf. push ( '-' ) ;
865
865
}
866
866
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
+ }
867
876
Ok ( ParserNumber :: String ( buf) )
868
877
}
869
878
Original file line number Diff line number Diff line change 303
303
#![ doc( html_root_url = "https://docs.rs/serde_json/1.0.74" ) ]
304
304
// Ignored clippy lints
305
305
#![ allow(
306
+ clippy:: collapsible_else_if,
306
307
clippy:: comparison_chain,
307
308
clippy:: deprecated_cfg_attr,
308
309
clippy:: doc_markdown,
Original file line number Diff line number Diff line change @@ -715,11 +715,7 @@ fn test_parse_char() {
715
715
) ,
716
716
(
717
717
"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" ,
723
719
) ,
724
720
] ) ;
725
721
@@ -1203,11 +1199,7 @@ fn test_parse_struct() {
1203
1199
test_parse_err :: < Outer > ( & [
1204
1200
(
1205
1201
"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" ,
1211
1203
) ,
1212
1204
(
1213
1205
"\" hello\" " ,
You can’t perform that action at this time.
0 commit comments