1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-09 03:56:01 +01:00

refactor(libutil): remove showBytes() in favor of renderSize()

The `showBytes()` function was redundant with `renderSize()` as the
latter automatically selects the appropriate unit (KiB, MiB, GiB, etc.)
based on the value, whereas `showBytes()` always formatted as MiB
regardless of size.

Co-authored-by: Bernardo Meurer Costa <beme@anthropic.com>
(cherry picked from commit f234633e27)
This commit is contained in:
Marcel 2025-10-27 00:55:40 +01:00 committed by github-actions[bot]
parent 01fd08803e
commit a5a7769d84
5 changed files with 2 additions and 11 deletions

View file

@ -317,9 +317,4 @@ std::pair<std::string_view, std::string_view> getLine(std::string_view s)
}
}
std::string showBytes(uint64_t bytes)
{
return fmt("%.2f MiB", bytes / (1024.0 * 1024.0));
}
} // namespace nix