Skip to content

Commit

Permalink
fix clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason committed Oct 6, 2024
1 parent d406364 commit e070efb
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions crates/zkwasm/src/runtime/monitor/plugins/table/transaction/v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,17 @@ impl Checkpoint {
.unwrap_or_default();

let number = *group_number - applied;
if number == limit {
ordering = Ordering::Equal;
} else if number > limit {
return Ordering::Greater;
match number.cmp(&limit) {
Ordering::Less => (),
Ordering::Equal => {
ordering = Ordering::Equal;
}
Ordering::Greater => return Ordering::Greater,
}
}
}

return ordering;
ordering
}
}

Expand Down Expand Up @@ -149,7 +151,7 @@ impl Checkpoints {
let start = self
.transactions
.remove(&tx)
.expect(&format!("commit a not existing transaction {}", tx));
.unwrap_or_else(|| panic!("commit a not existing transaction {}", tx));

let committed_tx = self.total_transactions_group_number.entry(tx).or_default();
*committed_tx += 1;
Expand Down Expand Up @@ -298,7 +300,7 @@ impl Checkpoints {
if checkpoint.range.before(upper_bound) {
self.checkpoints.drain(0..=index);

return checkpoint.range.end.unwrap();
checkpoint.range.end.unwrap()
} else {
let position = upper_bound;

Expand All @@ -311,7 +313,7 @@ impl Checkpoints {
self.checkpoints.drain(0..=index);
}

return position;
position
}
}

Expand Down Expand Up @@ -344,7 +346,7 @@ impl Checkpoints {
self.checkpoints[..=last]
.iter()
.rev()
.position(|checkpoint| filter(checkpoint))
.position(filter)
.map(|position| self.checkpoints.len() - 1 - position)
}

Expand Down

0 comments on commit e070efb

Please sign in to comment.