From 0f0416054f263b80ccec1a463ce4ab20913bdf71 Mon Sep 17 00:00:00 2001 From: Laurenz Date: Fri, 15 Jan 2021 15:43:59 +0100 Subject: =?UTF-8?q?Move=20value=20tests=20+=20smarter=20number=20formattin?= =?UTF-8?q?g=20=F0=9F=94=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/syntax/expr.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/syntax') 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%}"); -- cgit v1.2.3