Simplify some Option / Result / ? operator patterns (#8653)

* Simplify some Option / Result / ? operator patterns

When those match a combinator exactly.

Tool-aided by [comby-rust](https://github.com/huitseeker/comby-rust).

* adjust after review

* adjust post-review
This commit is contained in:
François Garillot
2021-04-23 09:36:10 -04:00
committed by GitHub
parent 541692c4a8
commit 052be8bbef
37 changed files with 77 additions and 188 deletions
@@ -104,10 +104,7 @@ pub async fn seal_block<B, BI, SC, C, E, P>(
// or fetch the best_block.
let parent = match parent_hash {
Some(hash) => {
match client.header(BlockId::Hash(hash))? {
Some(header) => header,
None => return Err(Error::BlockNotFound(format!("{}", hash))),
}
client.header(BlockId::Hash(hash))?.ok_or_else(|| Error::BlockNotFound(format!("{}", hash)))?
}
None => select_chain.best_chain()?
};