Skip to content

Commit ab47796

Browse files
committed
Remove the lax_deserialize feature
1 parent 169cc5b commit ab47796

File tree

6 files changed

+1
-32
lines changed

6 files changed

+1
-32
lines changed

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ default-features = false
1616

1717
[features]
1818
float_deserialize = ["serde"]
19-
lax_deserialize = ["float_deserialize"]
2019
default = ["std"]
2120
std = []
2221

src/int.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -590,11 +590,8 @@ impl<'de> Deserialize<'de> for Int {
590590

591591
#[cfg(feature = "float_deserialize")]
592592
{
593-
#[cfg(not(feature = "lax_deserialize"))]
594593
const EXPECTING: &str =
595594
"a number between -2^53 + 1 and 2^53 - 1 without fractional component";
596-
#[cfg(feature = "lax_deserialize")]
597-
const EXPECTING: &str = "a number between -2^53 + 1 and 2^53 - 1";
598595

599596
let val = f64::deserialize(deserializer)?;
600597

src/lib.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,5 @@ pub use self::{
5757
#[cfg(feature = "float_deserialize")]
5858
#[inline(always)]
5959
pub(crate) fn is_acceptable_float(float: f64) -> bool {
60-
#[cfg(not(feature = "lax_deserialize"))]
61-
{
62-
if float.fract() != 0.0 {
63-
return false;
64-
}
65-
}
66-
67-
!float.is_nan()
60+
!float.is_nan() && float.fract() == 0.0
6861
}

src/uint.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -585,10 +585,7 @@ impl<'de> Deserialize<'de> for UInt {
585585

586586
#[cfg(feature = "float_deserialize")]
587587
{
588-
#[cfg(not(feature = "lax_deserialize"))]
589588
const EXPECTING: &str = "a number between 0 and 2^53 - 1 without fractional component";
590-
#[cfg(feature = "lax_deserialize")]
591-
const EXPECTING: &str = "a number between 0 and 2^53 - 1";
592589

593590
let val = f64::deserialize(deserializer)?;
594591

tests/int.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ fn dont_deserialize_integral_float() {
4141
}
4242

4343
#[test]
44-
#[cfg_attr(feature = "lax_deserialize", ignore)]
4544
fn dont_deserialize_fractional_float() {
4645
assert!(deserialize_from(0.5).is_err());
4746
assert!(deserialize_from(42.1337).is_err());
@@ -67,14 +66,6 @@ fn deserialize_integral_float() {
6766
assert!(deserialize_from(f64::NEG_INFINITY).is_err());
6867
}
6968

70-
#[test]
71-
#[cfg_attr(not(feature = "lax_deserialize"), ignore)]
72-
fn deserialize_fractional_float() {
73-
assert_eq!(deserialize_from(0.5).unwrap(), int!(0));
74-
assert_eq!(deserialize_from(42.1337).unwrap(), int!(42));
75-
assert_eq!(deserialize_from(-42.1337).unwrap(), int!(-42));
76-
}
77-
7869
fn deserialize_from<'de, Value: IntoDeserializer<'de>>(
7970
value: Value,
8071
) -> Result<Int, serde::de::value::Error> {

tests/uint.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ fn dont_deserialize_integral_float() {
3535
}
3636

3737
#[test]
38-
#[cfg_attr(feature = "lax_deserialize", ignore)]
3938
fn dont_deserialize_fractional_float() {
4039
assert!(deserialize_from(0.5).is_err());
4140
assert!(deserialize_from(42.1337).is_err());
@@ -58,13 +57,6 @@ fn deserialize_integral_float() {
5857
assert!(deserialize_from(f64::NEG_INFINITY).is_err());
5958
}
6059

61-
#[test]
62-
#[cfg_attr(not(feature = "lax_deserialize"), ignore)]
63-
fn deserialize_fractional_float() {
64-
assert_eq!(deserialize_from(0.5).unwrap(), uint!(0));
65-
assert_eq!(deserialize_from(42.1337).unwrap(), uint!(42));
66-
}
67-
6860
fn deserialize_from<'de, Value: IntoDeserializer<'de>>(
6961
value: Value,
7062
) -> Result<UInt, serde::de::value::Error> {

0 commit comments

Comments
 (0)