Skip to content

Commit

Permalink
util: formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
hch12907 committed Nov 18, 2023
1 parent efeaaf8 commit b5e0f37
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ where
/// TOML 0 ---> None
/// TOML 1234 ---> Some(1234)
/// ```
pub(super) fn parse_number_into_optional_nonzero<'de, D>(deserializer: D) -> Result<Option<NonZeroU32>, D::Error>
pub(super) fn parse_number_into_optional_nonzero<'de, D>(
deserializer: D,
) -> Result<Option<NonZeroU32>, D::Error>
where
D: Deserializer<'de>,
{
Expand All @@ -72,7 +74,7 @@ where
if value > u32::MAX as u64 {
Err(E::invalid_type(
serde::de::Unexpected::Unsigned(value as u64),
&"an unsigned integer between 0 to 4294967295"
&"an unsigned integer between 0 to 4294967295",
))
} else {
Ok(NonZeroU32::new(value as u32))
Expand All @@ -86,12 +88,12 @@ where
if value > u32::MAX as i64 {
Err(E::invalid_type(
serde::de::Unexpected::Signed(value),
&"an unsigned integer between 0 to 4294967295"
&"an unsigned integer between 0 to 4294967295",
))
} else if value < u32::MIN as i64 {
Err(E::invalid_type(
serde::de::Unexpected::Signed(value),
&"an unsigned integer"
&"an unsigned integer",
))
} else {
Ok(NonZeroU32::new(value as u32))
Expand Down

0 comments on commit b5e0f37

Please sign in to comment.