Skip to content

Commit

Permalink
rustfmt
Browse files Browse the repository at this point in the history
  • Loading branch information
hawkw committed Feb 27, 2024
1 parent ec12295 commit 1bf4c9a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
11 changes: 4 additions & 7 deletions cmd/counters/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,12 +166,10 @@ fn counters(context: &mut ExecutionContext) -> Result<()> {
while let Some(((varname, var), def)) = ctrs.next() {
if let Some(def) = def {
println!(" +---> {varname}:");
let pad = if ctrs.peek().is_some() {
" | "
} else {
" "
};
if let Err(e) = counter_dump(hubris, core, def, var, subargs.full, pad) {
let pad = if ctrs.peek().is_some() { " | " } else { " " };
if let Err(e) =
counter_dump(hubris, core, def, var, subargs.full, pad)
{
if subargs.verbose {
humility::msg!("counter dump failed: {e:?}");
} else {
Expand All @@ -182,7 +180,6 @@ fn counters(context: &mut ExecutionContext) -> Result<()> {
humility::msg!("could not look up type: {:?}", var.goff);
}
}

}
Ok(())
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/ringbuf/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ fn ringbuf_dump(
let ringbuf = Ringbuf::from_value(&cell.cell.value)?;
Ok::<_, anyhow::Error>((Some(ringbuf), None))
})?;

if let (Some(counters), false) = (counters, no_totals) {
const TOTAL_WIDTH: usize = 8;
if full_totals {
Expand Down
13 changes: 9 additions & 4 deletions humility-doppel/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -399,8 +399,14 @@ impl Counters {
self.counts.values().map(CounterVariant::total).sum()
}

pub fn display_padded<'a>(&'a self, pad: &'a str) -> impl fmt::Display + 'a {
struct PaddedCtrs<'a> {ctrs: &'a Counters, pad: &'a str }
pub fn display_padded<'a>(
&'a self,
pad: &'a str,
) -> impl fmt::Display + 'a {
struct PaddedCtrs<'a> {
ctrs: &'a Counters,
pad: &'a str,
}
impl fmt::Display for PaddedCtrs<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
self.ctrs.fmt_padded(self.pad, f)
Expand All @@ -416,7 +422,7 @@ impl Counters {
prefix: &str,
Counters { ref counts }: &Counters,
indent: usize,
f: &mut fmt::Formatter<'_>
f: &mut fmt::Formatter<'_>,
) -> fmt::Result {
let total_len = f.width().unwrap_or(8);
let (before, after) =
Expand Down Expand Up @@ -476,7 +482,6 @@ impl Counters {
}
}


impl humility::reflect::Load for CounterVariant {
fn from_value(value: &Value) -> Result<Self> {
let counter = value.as_struct()?;
Expand Down

0 comments on commit 1bf4c9a

Please sign in to comment.