diff options
| author | Laurenz <laurmaedje@gmail.com> | 2021-01-15 15:43:59 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2021-01-15 15:43:59 +0100 |
| commit | 0f0416054f263b80ccec1a463ce4ab20913bdf71 (patch) | |
| tree | 09cc642c361327c386e88e89f81f512248d59514 /src/syntax/expr.rs | |
| parent | 469d78d610085044845f0fba462f1d8170b62cd4 (diff) | |
Move value tests + smarter number formatting 🔢
Diffstat (limited to 'src/syntax/expr.rs')
| -rw-r--r-- | src/syntax/expr.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/syntax/expr.rs b/src/syntax/expr.rs index b758a849..79533918 100644 --- a/src/syntax/expr.rs +++ b/src/syntax/expr.rs @@ -54,8 +54,8 @@ impl Pretty for Expr { Self::None => p.push_str("none"), Self::Ident(v) => p.push_str(&v), Self::Bool(v) => write!(p, "{}", v).unwrap(), - Self::Int(v) => write!(p, "{}", v).unwrap(), - Self::Float(v) => write!(p, "{}", v).unwrap(), + Self::Int(v) => p.push_str(itoa::Buffer::new().format(*v)), + Self::Float(v) => p.push_str(ryu::Buffer::new().format(*v)), Self::Length(v, u) => write!(p, "{}{}", v, u).unwrap(), Self::Angle(v, u) => write!(p, "{}{}", v, u).unwrap(), Self::Percent(v) => write!(p, "{}%", v).unwrap(), @@ -370,7 +370,7 @@ mod tests { test_pretty("{true}", "{true}"); test_pretty("{25}", "{25}"); test_pretty("{2.50}", "{2.5}"); - test_pretty("{1e2}", "{100}"); + test_pretty("{1e2}", "{100.0}"); test_pretty("{12pt}", "{12pt}"); test_pretty("{90.0deg}", "{90deg}"); test_pretty("{50%}", "{50%}"); |
