Skip to content

Commit 0be02e9

Browse files
committed
free: adapt to bytesize API change
function to_string_as() got removed
1 parent 7312025 commit 0be02e9

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/uu/free/src/free.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,17 @@ fn construct_committed_str(mem_info: &MemInfo, n2s: &dyn Fn(u64) -> String) -> S
458458

459459
// Here's the `-h` `--human` flag processing logic
460460
fn humanized(kib: u64, si: bool) -> String {
461-
let binding = ByteSize::kib(kib).to_string_as(!si);
461+
let binding = {
462+
let display = ByteSize::kib(kib).display();
463+
464+
if si {
465+
display.si()
466+
} else {
467+
display.iec()
468+
}
469+
}
470+
.to_string();
471+
462472
let split: Vec<&str> = binding.split(' ').collect();
463473

464474
// TODO: finish the logic of automatic scale.

0 commit comments

Comments
 (0)