Skip to content

Commit

Permalink
Remove unnecessary adapters, fix feature combination errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Bartlett authored and Licenser committed Oct 22, 2024
1 parent a984f57 commit 45e250d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 13 deletions.
6 changes: 3 additions & 3 deletions src/numberparse/approx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ impl<'de> Deserializer<'de> {
ErrorType::InvalidNumber,
))
} else {
Ok(StaticNode::F64(if negative { -i } else { i }))
Ok(StaticNode::from(if negative { -i } else { i }))
}
}

Expand Down Expand Up @@ -523,15 +523,15 @@ impl<'de> Deserializer<'de> {
// We want 0.1e1 to be a float.
//////////
if i == 0 {
StaticNode::F64(0.0)
StaticNode::from(0.0)
} else {
if !(-323..=308).contains(&exponent) {
return Self::parse_float(idx, buf, negative);
}

let mut d1: f64 = i as f64;
d1 *= unsafe { POWER_OF_TEN.get_kinda_unchecked((323 + exponent) as usize) };
StaticNode::F64(if negative { d1 * -1.0 } else { d1 })
StaticNode::from(if negative { d1 * -1.0 } else { d1 })
}
} else {
if unlikely!(byte_count >= 18) {
Expand Down
6 changes: 1 addition & 5 deletions src/value/borrowed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -954,10 +954,6 @@ mod test {
assert_eq!(Value::default(), Value::null());
}

fn static_node_f64(f: f64) -> StaticNode {
StaticNode::from(f)
}

#[cfg(not(target_arch = "wasm32"))]
use proptest::prelude::*;

Expand All @@ -975,7 +971,7 @@ mod test {
.prop_map(StaticNode::U64)
.prop_map(Value::Static),
any::<f64>()
.prop_map(static_node_f64)
.prop_map(StaticNode::from)
.prop_map(Value::Static),
".*".prop_map(Value::from),
];
Expand Down
6 changes: 1 addition & 5 deletions src/value/owned.rs
Original file line number Diff line number Diff line change
Expand Up @@ -803,10 +803,6 @@ mod test {
assert_eq!(Value::default(), Value::null());
}

fn static_node_f64(f: f64) -> StaticNode {
StaticNode::from(f)
}

#[cfg(not(target_arch = "wasm32"))]
use proptest::prelude::*;
#[cfg(not(target_arch = "wasm32"))]
Expand All @@ -820,7 +816,7 @@ mod test {
.prop_map(StaticNode::I64)
.prop_map(Value::Static),
any::<f64>()
.prop_map(static_node_f64)
.prop_map(StaticNode::from)
.prop_map(Value::Static),
".*".prop_map(Value::from),
];
Expand Down

0 comments on commit 45e250d

Please sign in to comment.