Skip to content

Commit 30bd4f8

Browse files
authored
Merge pull request #337 from cakebaker/bump_bytesize
Bump `bytesize` and adapt `free` to API change
2 parents 6ee4f13 + 0be02e9 commit 30bd4f8

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ feat_common_core = [
4343
]
4444

4545
[workspace.dependencies]
46-
bytesize = "1.3.0"
46+
bytesize = "2.0.0"
4747
chrono = { version = "0.4.38", default-features = false, features = ["clock"] }
4848
clap = { version = "4.5.4", features = ["wrap_help", "cargo"] }
4949
clap_complete = "4.5.2"

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)