mirror of
https://github.com/ouch-org/ouch.git
synced 2025-06-06 11:35:45 +00:00
cargo fmt
This commit is contained in:
parent
8c51f76d0d
commit
0cd8485028
@ -110,25 +110,16 @@ impl std::fmt::Display for Bytes {
|
||||
debug_assert!(num >= 0.0);
|
||||
if num < 1_f64 {
|
||||
let num_pretty = format!("{:.2}", num);
|
||||
return write!(
|
||||
f,
|
||||
"{:>6} B",
|
||||
num_pretty
|
||||
);
|
||||
return write!(f, "{:>6} B", num_pretty);
|
||||
}
|
||||
|
||||
let delimiter = 1000_f64;
|
||||
let exponent = cmp::min((num.ln() / 6.90775).floor() as i32, 4);
|
||||
|
||||
let num_pretty = format!("{:.2}", (num / delimiter.powi(exponent)));
|
||||
let unit_pretty = format!("{}B", Bytes::UNIT_PREFIXES[exponent as usize]);
|
||||
let unit_pretty = format!("{}B", Bytes::UNIT_PREFIXES[exponent as usize]);
|
||||
|
||||
write!(
|
||||
f,
|
||||
"{:>6} {:>3}",
|
||||
num_pretty,
|
||||
unit_pretty,
|
||||
)
|
||||
write!(f, "{:>6} {:>3}", num_pretty, unit_pretty,)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user