From a2053c850515a0d9f45cd0a3cec9acc555117e87 Mon Sep 17 00:00:00 2001 From: Daniel Lockyer Date: Thu, 30 Mar 2017 12:40:27 +0100 Subject: Simplify if-statements --- tests/valid.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/valid.rs b/tests/valid.rs index 4229f1c..e8ea6af 100644 --- a/tests/valid.rs +++ b/tests/valid.rs @@ -18,7 +18,7 @@ fn to_json(toml: toml::Value) -> Json { Toml::Float(f) => doit("float", Json::String({ let s = format!("{:.15}", f); let s = format!("{}", s.trim_right_matches('0')); - if s.ends_with(".") {format!("{}0", s)} else {s} + if s.ends_with('.') {format!("{}0", s)} else {s} })), Toml::Boolean(b) => doit("bool", Json::String(format!("{}", b))), Toml::Datetime(s) => doit("datetime", Json::String(s.to_string())), -- cgit v1.2.3