Skip to content

Commit

Permalink
chore: clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
zeroXbrock committed Feb 4, 2025
1 parent cc5419f commit 65bd969
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 16 deletions.
9 changes: 2 additions & 7 deletions crates/cli/src/commands/report/chart/heatmap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ impl HeatMapChart {
if let Some(slot_map) = self.updates_per_slot_per_block.get_mut(&block_num) {
let value = slot_map.get(&slot).map(|v| v + 1).unwrap_or(1);
slot_map.insert(slot, value);
return;
} else {
let mut slot_map = BTreeMap::new();
slot_map.insert(slot, 1);
Expand Down Expand Up @@ -101,7 +100,7 @@ impl HeatMapChart {
let mut slot_counter = 0;
for slot in all_keys {
if !slot_indices.contains_key(slot) {
slot_indices.insert(slot.clone(), slot_counter);
slot_indices.insert(*slot, slot_counter);
slot_counter += 1;
}
}
Expand Down Expand Up @@ -179,11 +178,7 @@ impl HeatMapChart {
.get(*i - 1)
.map(|n| n.to_owned())
.unwrap_or_default();
format!(
"{}...{}",
slot_name[..8].to_string(),
slot_name[60..].to_string()
)
format!("{}...{}", &slot_name[..8], &slot_name[60..])
})
.x_label_offset(24)
.y_label_offset(24)
Expand Down
19 changes: 10 additions & 9 deletions crates/cli/src/commands/report/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,15 @@ enum ReportChartId {
TxGasUsed,
}

impl ToString for ReportChartId {
fn to_string(&self) -> String {
match self {
ReportChartId::Heatmap => "heatmap".to_string(),
ReportChartId::GasPerBlock => "gas_per_block".to_string(),
ReportChartId::TimeToInclusion => "time_to_inclusion".to_string(),
ReportChartId::TxGasUsed => "tx_gas_used".to_string(),
}
impl std::fmt::Display for ReportChartId {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let s = match self {
ReportChartId::Heatmap => "heatmap",
ReportChartId::GasPerBlock => "gas_per_block",
ReportChartId::TimeToInclusion => "time_to_inclusion",
ReportChartId::TxGasUsed => "tx_gas_used",
};
write!(f, "{}", s)
}
}

Expand All @@ -91,7 +92,7 @@ impl ReportChartId {
Ok(format!(
"{}/{}_run-{}-{}.png",
report_dir()?,
self.to_string(),
self,
start_run_id,
end_run_id
))
Expand Down

0 comments on commit 65bd969

Please sign in to comment.