mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 21:31:02 +00:00
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:
committed by
GitHub
parent
541692c4a8
commit
052be8bbef
@@ -289,14 +289,10 @@ where
|
||||
fn consume(
|
||||
mut self,
|
||||
) -> Option<(AuthoritySet<H, N>, SharedDataLocked<'a, AuthoritySet<H, N>>)> {
|
||||
if let Some(old) = self.old.take() {
|
||||
Some((
|
||||
self.old.take().map(|old| (
|
||||
old,
|
||||
self.guard.take().expect("only taken on deconstruction; qed"),
|
||||
))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1134,13 +1134,12 @@ fn local_authority_id(
|
||||
voters: &VoterSet<AuthorityId>,
|
||||
keystore: Option<&SyncCryptoStorePtr>,
|
||||
) -> Option<AuthorityId> {
|
||||
match keystore {
|
||||
Some(keystore) => voters
|
||||
.iter()
|
||||
.find(|(p, _)| {
|
||||
SyncCryptoStore::has_keys(&**keystore, &[(p.to_raw_vec(), AuthorityId::ID)])
|
||||
})
|
||||
.map(|(p, _)| p.clone()),
|
||||
None => None,
|
||||
}
|
||||
keystore.and_then(|keystore| {
|
||||
voters
|
||||
.iter()
|
||||
.find(|(p, _)| {
|
||||
SyncCryptoStore::has_keys(&**keystore, &[(p.to_raw_vec(), AuthorityId::ID)])
|
||||
})
|
||||
.map(|(p, _)| p.clone())
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user