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
@@ -150,10 +150,8 @@ impl<BlockHash: Hash, Key: Hash> NonCanonicalOverlay<BlockHash, Key> {
pub fn new<D: MetaDb>(db: &D) -> Result<NonCanonicalOverlay<BlockHash, Key>, Error<D::Error>> {
let last_canonicalized = db.get_meta(&to_meta_key(LAST_CANONICAL, &()))
.map_err(|e| Error::Db(e))?;
let last_canonicalized = match last_canonicalized {
Some(buffer) => Some(<(BlockHash, u64)>::decode(&mut buffer.as_slice())?),
None => None,
};
let last_canonicalized = last_canonicalized
.map(|buffer| <(BlockHash, u64)>::decode(&mut buffer.as_slice())).transpose()?;
let mut levels = VecDeque::new();
let mut parents = HashMap::new();
let mut values = HashMap::new();