Skip to content

Commit

Permalink
ugh borrow checker
Browse files Browse the repository at this point in the history
Created using spr 1.3.5
  • Loading branch information
sunshowers committed Nov 28, 2023
1 parent a6085cf commit 0bca801
Showing 1 changed file with 22 additions and 25 deletions.
47 changes: 22 additions & 25 deletions update-engine/src/display/group_display.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,37 +151,34 @@ impl<K: Eq + Ord, W: std::io::Write, S: StepSpec> GroupDisplay<K, W, S> {
}

self.stats.apply_result(result);
self.log_result(&state.prefix, &result);

if result.before != result.after {
slog::info!(
self.log,
"add_event_report caused state transition";
"prefix" => &state.prefix,
"before" => %result.before,
"after" => %result.after,
"current_stats" => ?self.stats,
"root_total_elapsed" => ?result.root_total_elapsed,
);
} else {
slog::debug!(
self.log,
"add_event_report called, state did not change";
"prefix" => &state.prefix,
"state" => %result.before,
"current_stats" => ?self.stats,
"root_total_elapsed" => ?result.root_total_elapsed,
);
}

Ok(())
} else {
Err(UnknownReportKey {})
}
}

fn log_result(&self, prefix: &str, result: &AddEventReportResult) {
slog::debug!(
self.log,
"add_event_report called";
"prefix" => prefix,
"before" => %result.before,
"after" => %result.after,
"stats" => ?self.stats,
"root_total_elapsed" => ?result.root_total_elapsed,
);

if result.before != result.after {
slog::info!(
self.log,
"add_event_report caused state transition";
"prefix" => prefix,
"before" => %result.before,
"after" => %result.after,
"stats" => ?self.stats,
"root_total_elapsed" => ?result.root_total_elapsed,
);
}
}

/// Writes a "Status" or "Summary" line to the writer with statistics.
pub fn write_stats(&mut self, header: &str) -> std::io::Result<()> {
// Add a blank prefix which is equal to the maximum width of known prefixes.
Expand Down

0 comments on commit 0bca801

Please sign in to comment.