Skip to content

Commit 294b0e5

Browse files
committed
Make numeric error conversion consistent
Most of the repo uses a bare `?` operator to convert numeric types, but some places use `.map_err(E::Numeric)?`. Use the bare `?` operator everywhere for consistency.
1 parent e38f330 commit 294b0e5

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

types/src/v26/blockchain/into.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ impl GetChainStates {
1515
use GetChainStatesError as E;
1616

1717
Ok(model::GetChainStates {
18-
headers: crate::to_u32(self.headers, "headers").map_err(E::Numeric)?,
18+
headers: crate::to_u32(self.headers, "headers")?,
1919
chain_states: self
2020
.chain_states
2121
.into_iter()
2222
.map(|s| {
2323
Ok(model::ChainState {
24-
blocks: crate::to_u32(s.blocks, "blocks").map_err(E::Numeric)?,
24+
blocks: crate::to_u32(s.blocks, "blocks")?,
2525
best_block_hash: s.best_block_hash.parse().map_err(E::BestBlockHash)?,
2626
bits: None, // v29 and later only.
2727
target: None, // v29 and later only.

types/src/v29/blockchain/into.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,13 +176,13 @@ impl GetChainStates {
176176
use GetChainStatesError as E;
177177

178178
Ok(model::GetChainStates {
179-
headers: crate::to_u32(self.headers, "headers").map_err(E::Numeric)?,
179+
headers: crate::to_u32(self.headers, "headers")?,
180180
chain_states: self
181181
.chain_states
182182
.into_iter()
183183
.map(|s| {
184184
Ok(model::ChainState {
185-
blocks: crate::to_u32(s.blocks, "blocks").map_err(E::Numeric)?,
185+
blocks: crate::to_u32(s.blocks, "blocks")?,
186186
best_block_hash: s.best_block_hash.parse().map_err(E::BestBlockHash)?,
187187
bits: Some(CompactTarget::from_unprefixed_hex(&s.bits).map_err(E::Bits)?),
188188
target: Some(

0 commit comments

Comments
 (0)