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
+2 -4
View File
@@ -395,10 +395,8 @@ pub fn read_meta<Block>(db: &dyn Database<DbHash>, col_header: u32) -> Result<
};
let load_meta_block = |desc, key| -> Result<_, sp_blockchain::Error> {
if let Some(Some(header)) = match db.get(COLUMN_META, key) {
Some(id) => db.get(col_header, &id).map(|b| Block::Header::decode(&mut &b[..]).ok()),
None => None,
}
if let Some(Some(header)) = db.get(COLUMN_META, key)
.and_then(|id| db.get(col_header, &id).map(|b| Block::Header::decode(&mut &b[..]).ok()))
{
let hash = header.hash();
debug!(