Fix parsing of integer font sizes

Config file conversion broke parsing of the font size value if it's
written as an integer, since TOML integers are always signed.
This commit is contained in:
Pavel Roskin 2023-06-17 12:51:06 -07:00 committed by GitHub
parent 727531406c
commit 474ee4bb75
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -148,14 +148,14 @@ impl<'de> Deserialize<'de> for Size {
type Value = Size;
fn expecting(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str("f64 or u64")
f.write_str("f64 or i64")
}
fn visit_f64<E: de::Error>(self, value: f64) -> Result<Self::Value, E> {
Ok(Size(FontSize::new(value as f32)))
}
fn visit_u64<E: de::Error>(self, value: u64) -> Result<Self::Value, E> {
fn visit_i64<E: de::Error>(self, value: i64) -> Result<Self::Value, E> {
Ok(Size(FontSize::new(value as f32)))
}
}