summaryrefslogtreecommitdiffstats
path: root/src/units.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/units.rs')
-rw-r--r--src/units.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/units.rs b/src/units.rs
index cec5ffc..ac08ebf 100644
--- a/src/units.rs
+++ b/src/units.rs
@@ -134,7 +134,7 @@ pub(crate) fn parse_size(text: &str) -> Result<u64, String> {
pub(crate) fn format_size(bytes: u64) -> String {
SIZE_UNITS
.iter()
- .find(|(_, scale)| bytes != 0 && bytes % scale == 0)
+ .find(|(_, scale)| bytes != 0 && bytes.is_multiple_of(*scale))
.map(|(name, scale)| format!("{}{name}", bytes / scale))
.unwrap_or_else(|| "0B".to_owned())
}