mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 17:31:05 +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
@@ -256,10 +256,7 @@ pub trait SimpleSlotWorker<B: BlockT> {
|
||||
return None;
|
||||
}
|
||||
|
||||
let claim = match self.claim_slot(&chain_head, slot, &epoch_data) {
|
||||
None => return None,
|
||||
Some(claim) => claim,
|
||||
};
|
||||
let claim = self.claim_slot(&chain_head, slot, &epoch_data)?;
|
||||
|
||||
if self.should_backoff(slot, &chain_head) {
|
||||
return None;
|
||||
|
||||
@@ -135,10 +135,7 @@ impl<SC: SlotCompatible> Slots<SC> {
|
||||
Err(err) => return Err(sp_consensus::Error::InherentData(err)),
|
||||
};
|
||||
let result = self.timestamp_extractor.extract_timestamp_and_slot(&inherent_data);
|
||||
let (timestamp, slot, offset) = match result {
|
||||
Ok(v) => v,
|
||||
Err(err) => return Err(err),
|
||||
};
|
||||
let (timestamp, slot, offset) = result?;
|
||||
// reschedule delay for next slot.
|
||||
let ends_in = offset +
|
||||
time_until_next(timestamp.as_duration(), self.slot_duration);
|
||||
|
||||
Reference in New Issue
Block a user