diff options
| author | Laurenz <laurmaedje@gmail.com> | 2022-11-29 14:57:05 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2022-11-29 14:57:05 +0100 |
| commit | 579dac3c91faf73866f4b9b13381393ddf7b2f9b (patch) | |
| tree | e490708005997ba4db1d98ee1a2cac6c6d669c83 /src/model | |
| parent | 0efe669278a5e1c3f2985eba2f3360e91159c54a (diff) | |
Strong delta
Diffstat (limited to 'src/model')
| -rw-r--r-- | src/model/cast.rs | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/src/model/cast.rs b/src/model/cast.rs index df3c8c81..6a78eebd 100644 --- a/src/model/cast.rs +++ b/src/model/cast.rs @@ -280,10 +280,7 @@ castable! { castable! { FontWeight, Expected: "integer or string", - Value::Int(v) => Value::Int(v) - .cast::<usize>()? - .try_into() - .map_or(Self::BLACK, Self::from_number), + Value::Int(v) => Self::from_number(v.clamp(0, u16::MAX as i64) as u16), Value::Str(string) => match string.as_str() { "thin" => Self::THIN, "extralight" => Self::EXTRALIGHT, |
