Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/display.rs
Original file line number Diff line number Diff line change
Expand Up @@ -298,8 +298,8 @@ mod tests {
#[test]
fn precision() {
let size = ByteSize::mib(1908);
assert_eq!("1.9 GiB".to_string(), format!("{}", size));
assert_eq!("2 GiB".to_string(), format!("{:.0}", size));
assert_eq!("1.86328 GiB".to_string(), format!("{:.5}", size));
assert_eq!("1.9 GiB".to_string(), format!("{size}"));
assert_eq!("2 GiB".to_string(), format!("{size:.0}"));
assert_eq!("1.86328 GiB".to_string(), format!("{size:.5}"));
}
}
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ mod tests {

#[track_caller]
fn assert_display(expected: &str, b: ByteSize) {
assert_eq!(expected, format!("{}", b));
assert_eq!(expected, format!("{b}"));
}

#[test]
Expand Down
10 changes: 3 additions & 7 deletions src/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,11 @@ impl str::FromStr for ByteSize {
match suffix.parse::<Unit>() {
Ok(u) => Ok(Self((v * u) as u64)),
Err(error) => Err(format!(
"couldn't parse {:?} into a known SI unit, {}",
suffix, error
"couldn't parse {suffix:?} into a known SI unit, {error}"
)),
}
}
Err(error) => Err(format!(
"couldn't parse {:?} into a ByteSize, {}",
value, error
)),
Err(error) => Err(format!("couldn't parse {value:?} into a ByteSize, {error}")),
}
}
}
Expand Down Expand Up @@ -177,7 +173,7 @@ impl str::FromStr for Unit {
"gi" | "gib" => Ok(Self::GibiByte),
"ti" | "tib" => Ok(Self::TebiByte),
"pi" | "pib" => Ok(Self::PebiByte),
_ => Err(format!("couldn't parse unit of {:?}", unit)),
_ => Err(format!("couldn't parse unit of {unit:?}")),
}
}
}
Expand Down
Loading