Skip to content

Commit 5115f76

Browse files
committed
clippy fixes
Signed-off-by: Dave Huseby <[email protected]>
1 parent bc84f54 commit 5115f76

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/try_decode_from.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ impl<'a> TryDecodeFrom<'a> for bool {
1818
type Error = Error;
1919

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

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

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

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

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

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

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

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

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

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

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

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

0 commit comments

Comments
 (0)