Marketplace: use is_multiple_of in describe_size (clippy)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -53,9 +53,9 @@ pub enum ReadError {
|
|||||||
pub(crate) fn describe_size(bytes: u64) -> String {
|
pub(crate) fn describe_size(bytes: u64) -> String {
|
||||||
const KIB: u64 = 1024;
|
const KIB: u64 = 1024;
|
||||||
const MIB: u64 = 1024 * 1024;
|
const MIB: u64 = 1024 * 1024;
|
||||||
if bytes >= MIB && bytes % MIB == 0 {
|
if bytes >= MIB && bytes.is_multiple_of(MIB) {
|
||||||
format!("{} MiB", bytes / MIB)
|
format!("{} MiB", bytes / MIB)
|
||||||
} else if bytes >= KIB && bytes % KIB == 0 {
|
} else if bytes >= KIB && bytes.is_multiple_of(KIB) {
|
||||||
format!("{} KiB", bytes / KIB)
|
format!("{} KiB", bytes / KIB)
|
||||||
} else {
|
} else {
|
||||||
format!("{} bytes", bytes)
|
format!("{} bytes", bytes)
|
||||||
|
|||||||
Reference in New Issue
Block a user