From af4972f3ce2235ee3055b281f381214529f4e4ef Mon Sep 17 00:00:00 2001 From: Marvin Löbel Date: Sat, 2 Feb 2013 16:40:42 +0100 Subject: Fixed `fmt!`, tests, doc-tests. --- src/libcore/num/num.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/libcore/num') diff --git a/src/libcore/num/num.rs b/src/libcore/num/num.rs index 9a138de3cf3..30f6a727f0a 100644 --- a/src/libcore/num/num.rs +++ b/src/libcore/num/num.rs @@ -422,6 +422,12 @@ pub pure fn to_str_bytes_common( buf = buf.slice(0, i + 1); } } + } // If exact and trailing '.', just cut that + else { + let max_i = buf.len() - 1; + if buf[max_i] == '.' as u8 { + buf = buf.slice(0, max_i); + } } (buf, false) @@ -678,4 +684,4 @@ pub pure fn from_str_common( ) -> Option { from_str_bytes_common(str::to_bytes(buf), radix, negative, fractional, special, exponent, empty_zero) -} \ No newline at end of file +} -- cgit 1.4.1-3-g733a5