diff --git a/Cargo.toml b/Cargo.toml index d693e14..2cec4a7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -73,7 +73,7 @@ proptest = ["dep:proptest"] rand = ["dep:rand"] rkyv = ["dep:rkyv"] rkyv-safe = ["rkyv/validation"] -rocket-traits = ["dep:rocket"] +rocket-traits = ["dep:rocket", "std"] rust-fuzz = ["dep:arbitrary"] serde = ["dep:serde"] serde-arbitrary-precision = ["serde-with-arbitrary-precision"] diff --git a/src/decimal.rs b/src/decimal.rs index 5df67f3..e34fbea 100644 --- a/src/decimal.rs +++ b/src/decimal.rs @@ -573,7 +573,7 @@ impl Decimal { pub fn from_scientific(value: &str) -> Result { const ERROR_MESSAGE: &str = "Failed to parse"; - let mut split = value.splitn(2, |c| c == 'e' || c == 'E'); + let mut split = value.splitn(2, ['e', 'E']); let base = split.next().ok_or_else(|| Error::from(ERROR_MESSAGE))?; let exp = split.next().ok_or_else(|| Error::from(ERROR_MESSAGE))?; diff --git a/src/serde.rs b/src/serde.rs index c18e08e..ea19e89 100644 --- a/src/serde.rs +++ b/src/serde.rs @@ -370,8 +370,10 @@ impl<'de> serde::de::Visitor<'de> for DecimalVisitor { } } +#[cfg(any(feature = "serde-with-float", feature = "serde-with-arbitrary-precision"))] struct OptionDecimalVisitor; +#[cfg(any(feature = "serde-with-float", feature = "serde-with-arbitrary-precision"))] impl<'de> serde::de::Visitor<'de> for OptionDecimalVisitor { type Value = Option;