summaryrefslogtreecommitdiff
path: root/src/syntax
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2021-01-15 15:43:59 +0100
committerLaurenz <laurmaedje@gmail.com>2021-01-15 15:43:59 +0100
commit0f0416054f263b80ccec1a463ce4ab20913bdf71 (patch)
tree09cc642c361327c386e88e89f81f512248d59514 /src/syntax
parent469d78d610085044845f0fba462f1d8170b62cd4 (diff)
Move value tests + smarter number formatting 🔢
Diffstat (limited to 'src/syntax')
-rw-r--r--src/syntax/expr.rs6
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%}");