Skip to content

Commit cd38598

Browse files
committed
refactor(common): remove unnecessary 'map_err' with 'bincode' deserialization
1 parent a70a0d9 commit cd38598

File tree

3 files changed

+3
-6
lines changed

3 files changed

+3
-6
lines changed

mithril-common/src/crypto_helper/merkle_map.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -360,8 +360,7 @@ impl<K: MKMapKey + Serialize + for<'de> Deserialize<'de>> MKMapProof<K> {
360360
/// Convert the proof from bytes
361361
pub fn from_bytes(bytes: &[u8]) -> StdResult<Self> {
362362
let (res, _) =
363-
bincode::serde::decode_from_slice::<Self, _>(bytes, bincode::config::standard())
364-
.map_err(|e| anyhow!(e))?;
363+
bincode::serde::decode_from_slice::<Self, _>(bytes, bincode::config::standard())?;
365364

366365
Ok(res)
367366
}

mithril-common/src/crypto_helper/merkle_tree.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,7 @@ impl MKProof {
204204
/// Convert the proof from bytes
205205
pub fn from_bytes(bytes: &[u8]) -> StdResult<Self> {
206206
let (res, _) =
207-
bincode::serde::decode_from_slice::<Self, _>(bytes, bincode::config::standard())
208-
.map_err(|e| anyhow!(e))?;
207+
bincode::serde::decode_from_slice::<Self, _>(bytes, bincode::config::standard())?;
209208

210209
Ok(res)
211210
}

mithril-common/src/entities/signed_entity_type.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,7 @@ impl SignedEntityType {
160160
impl TryFromBytes for SignedEntityType {
161161
fn try_from_bytes(bytes: &[u8]) -> StdResult<Self> {
162162
let (res, _) =
163-
bincode::serde::decode_from_slice::<Self, _>(bytes, bincode::config::standard())
164-
.map_err(|e| anyhow!(e))?;
163+
bincode::serde::decode_from_slice::<Self, _>(bytes, bincode::config::standard())?;
165164

166165
Ok(res)
167166
}

0 commit comments

Comments
 (0)