Skip to content

Commit

Permalink
clippy fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Dave Huseby <[email protected]>
  • Loading branch information
dhuseby committed Aug 28, 2024
1 parent bc84f54 commit 5115f76
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/try_decode_from.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ impl<'a> TryDecodeFrom<'a> for bool {
type Error = Error;

fn try_decode_from(bytes: &'a [u8]) -> Result<(Self, &'a [u8]), Self::Error> {
let (v, ptr) = decode::u8(bytes).map_err(|e| Self::Error::UnsignedVarintDecode(e))?;
let (v, ptr) = decode::u8(bytes).map_err(Self::Error::UnsignedVarintDecode)?;
Ok(((v != 0), ptr))
}
}
Expand All @@ -28,7 +28,7 @@ impl<'a> TryDecodeFrom<'a> for u8 {
type Error = Error;

fn try_decode_from(bytes: &'a [u8]) -> Result<(Self, &'a [u8]), Self::Error> {
Ok(decode::u8(bytes).map_err(|e| Self::Error::UnsignedVarintDecode(e))?)
decode::u8(bytes).map_err(Self::Error::UnsignedVarintDecode)
}
}

Expand All @@ -37,7 +37,7 @@ impl<'a> TryDecodeFrom<'a> for u16 {
type Error = Error;

fn try_decode_from(bytes: &'a [u8]) -> Result<(Self, &'a [u8]), Self::Error> {
Ok(decode::u16(bytes).map_err(|e| Self::Error::UnsignedVarintDecode(e))?)
decode::u16(bytes).map_err(Self::Error::UnsignedVarintDecode)
}
}

Expand All @@ -46,7 +46,7 @@ impl<'a> TryDecodeFrom<'a> for u32 {
type Error = Error;

fn try_decode_from(bytes: &'a [u8]) -> Result<(Self, &'a [u8]), Self::Error> {
Ok(decode::u32(bytes).map_err(|e| Self::Error::UnsignedVarintDecode(e))?)
decode::u32(bytes).map_err(Self::Error::UnsignedVarintDecode)
}
}

Expand All @@ -55,7 +55,7 @@ impl<'a> TryDecodeFrom<'a> for u64 {
type Error = Error;

fn try_decode_from(bytes: &'a [u8]) -> Result<(Self, &'a [u8]), Self::Error> {
Ok(decode::u64(bytes).map_err(|e| Self::Error::UnsignedVarintDecode(e))?)
decode::u64(bytes).map_err(Self::Error::UnsignedVarintDecode)
}
}

Expand All @@ -64,7 +64,7 @@ impl<'a> TryDecodeFrom<'a> for u128 {
type Error = Error;

fn try_decode_from(bytes: &'a [u8]) -> Result<(Self, &'a [u8]), Self::Error> {
Ok(decode::u128(bytes).map_err(|e| Self::Error::UnsignedVarintDecode(e))?)
decode::u128(bytes).map_err(Self::Error::UnsignedVarintDecode)
}
}

Expand All @@ -73,6 +73,6 @@ impl<'a> TryDecodeFrom<'a> for usize {
type Error = Error;

fn try_decode_from(bytes: &'a [u8]) -> Result<(Self, &'a [u8]), Self::Error> {
Ok(decode::usize(bytes).map_err(|e| Self::Error::UnsignedVarintDecode(e))?)
decode::usize(bytes).map_err(Self::Error::UnsignedVarintDecode)
}
}

0 comments on commit 5115f76

Please sign in to comment.