clippy: add if_not_else clippy lint (#10524)

Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
Thomas Coratger
2024-08-26 03:58:06 -07:00
committed by GitHub
parent 1b1e835fb1
commit 709e7b73ce
21 changed files with 133 additions and 134 deletions

View File

@@ -652,13 +652,7 @@ where
return Ok(TreeOutcome::new(status))
}
let status = if !self.backfill_sync_state.is_idle() {
if let Err(error) = self.buffer_block_without_senders(block) {
self.on_insert_block_error(error)?
} else {
PayloadStatus::from_status(PayloadStatusEnum::Syncing)
}
} else {
let status = if self.backfill_sync_state.is_idle() {
let mut latest_valid_hash = None;
let num_hash = block.num_hash();
match self.insert_block_without_senders(block) {
@@ -684,6 +678,10 @@ where
}
Err(error) => self.on_insert_block_error(error)?,
}
} else if let Err(error) = self.buffer_block_without_senders(block) {
self.on_insert_block_error(error)?
} else {
PayloadStatus::from_status(PayloadStatusEnum::Syncing)
};
let mut outcome = TreeOutcome::new(status);
@@ -862,12 +860,12 @@ where
fn advance_persistence(&mut self) -> Result<(), TryRecvError> {
if self.should_persist() && !self.persistence_state.in_progress() {
let blocks_to_persist = self.get_canonical_blocks_to_persist();
if !blocks_to_persist.is_empty() {
if blocks_to_persist.is_empty() {
debug!(target: "engine", "Returned empty set of blocks to persist");
} else {
let (tx, rx) = oneshot::channel();
let _ = self.persistence.save_blocks(blocks_to_persist, tx);
self.persistence_state.start(rx);
} else {
debug!(target: "engine", "Returned empty set of blocks to persist");
}
}