forked from Proxmox/proxmox
[clippy] api-test: remaining changes to memory.rs
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
parent
c6e022523b
commit
d06b2b277c
@ -42,16 +42,16 @@ impl<'de, U: Unit> serde::de::Visitor<'de> for MemoryVisitor<U> {
|
||||
}
|
||||
|
||||
fn visit_u8<E: serde::de::Error>(self, v: u8) -> Result<Self::Value, E> {
|
||||
Ok(Memory::from_bytes(v as u64 * U::FACTOR))
|
||||
Ok(Memory::from_bytes(u64::from(v) * U::FACTOR))
|
||||
}
|
||||
fn visit_u16<E: serde::de::Error>(self, v: u16) -> Result<Self::Value, E> {
|
||||
Ok(Memory::from_bytes(v as u64 * U::FACTOR))
|
||||
Ok(Memory::from_bytes(u64::from(v) * U::FACTOR))
|
||||
}
|
||||
fn visit_u32<E: serde::de::Error>(self, v: u32) -> Result<Self::Value, E> {
|
||||
Ok(Memory::from_bytes(v as u64 * U::FACTOR))
|
||||
Ok(Memory::from_bytes(u64::from(v) * U::FACTOR))
|
||||
}
|
||||
fn visit_u64<E: serde::de::Error>(self, v: u64) -> Result<Self::Value, E> {
|
||||
Ok(Memory::from_bytes(v as u64 * U::FACTOR))
|
||||
Ok(Memory::from_bytes(v * U::FACTOR))
|
||||
}
|
||||
|
||||
fn visit_str<E: serde::de::Error>(self, v: &str) -> Result<Self::Value, E> {
|
||||
|
@ -58,7 +58,7 @@ fn test_suffixes() {
|
||||
|
||||
impl std::fmt::Display for Memory {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||
const SUFFIXES: &'static [&'static str] = &["b", "KiB", "MiB", "GiB", "TiB"];
|
||||
const SUFFIXES: &[&str] = &["b", "KiB", "MiB", "GiB", "TiB"];
|
||||
let mut n = self.0;
|
||||
let mut i = 0;
|
||||
while i < SUFFIXES.len() && n.trailing_zeros() >= 10 {
|
||||
|
Loading…
Reference in New Issue
Block a user