Use ok_or instead of ok_or_else with unnecessary closure (#1106)

https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_lazy_evaluations
This commit is contained in:
Deirdre Connolly 2020-09-28 21:10:51 -04:00 committed by GitHub
parent 2230e353df
commit 2d9198628c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -119,7 +119,7 @@ where
// height for parsed blocks when we deserialize them. // height for parsed blocks when we deserialize them.
let height = block let height = block
.coinbase_height() .coinbase_height()
.ok_or_else(|| BlockError::MissingHeight(hash))?; .ok_or(BlockError::MissingHeight(hash))?;
if height > block::Height::MAX { if height > block::Height::MAX {
Err(BlockError::MaxHeight(height, hash, block::Height::MAX))?; Err(BlockError::MaxHeight(height, hash, block::Height::MAX))?;
} }
@ -130,7 +130,7 @@ where
.header .header
.difficulty_threshold .difficulty_threshold
.to_expanded() .to_expanded()
.ok_or_else(|| BlockError::InvalidDifficulty(height, hash))?; .ok_or(BlockError::InvalidDifficulty(height, hash))?;
if hash > difficulty_threshold { if hash > difficulty_threshold {
Err(BlockError::DifficultyFilter( Err(BlockError::DifficultyFilter(
height, height,