Skip to content

Commit fdee54b

Browse files
committed
Check only for is_nan because infinity was already checked.
1 parent b369adc commit fdee54b

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/int.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,7 @@ impl<'de> Deserialize<'de> for Int {
582582
{
583583
let val = f64::deserialize(deserializer)?;
584584

585-
if val > MAX_SAFE_INT as f64 || val < MIN_SAFE_INT as f64 || !val.is_finite() {
585+
if val > MAX_SAFE_INT as f64 || val < MIN_SAFE_INT as f64 || val.is_nan() {
586586
Err(D::Error::invalid_value(
587587
Unexpected::Float(val),
588588
&"a number between -2^53 + 1 and 2^53 - 1",

src/uint.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,7 @@ impl<'de> Deserialize<'de> for UInt {
589589
{
590590
let val = f64::deserialize(deserializer)?;
591591

592-
if val < 0.0 || val > MAX_SAFE_UINT as f64 || !val.is_finite() {
592+
if val < 0.0 || val > MAX_SAFE_UINT as f64 || val.is_nan() {
593593
Err(D::Error::invalid_value(
594594
Unexpected::Float(val),
595595
&"a number between 0 and 2^53 - 1",

0 commit comments

Comments
 (0)