Skip to content

Commit ff936b0

Browse files
committed
---
yaml --- r: 162303 b: refs/heads/auto c: fec0f16 h: refs/heads/master i: 162301: 49089d5 162299: 3ec4c21 162295: 40294b6 162287: ab327f9 162271: b3f070d 162239: bb17b9e 162175: de3900a 162047: d9ca7c5 161791: e2da103 v: v3
1 parent 62daa7d commit ff936b0

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1010
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1111
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1212
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
13-
refs/heads/auto: f102123b659911dbee25bbe518d73d66185bb978
13+
refs/heads/auto: fec0f16c98ab066ff11be35b5a8bb0d80efa90f1
1414
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1515
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1616
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

branches/auto/src/libserialize/json.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,8 @@ fn spaces(wr: &mut io::Writer, mut n: uint) -> Result<(), io::IoError> {
386386
fn fmt_number_or_null(v: f64) -> string::String {
387387
match v.classify() {
388388
FPNaN | FPInfinite => string::String::from_str("null"),
389-
_ => f64::to_str_digits(v, 6u)
389+
_ if v.fract() != 0f64 => f64::to_str_digits(v, 6u),
390+
_ => f64::to_str_digits(v, 6u) + ".0",
390391
}
391392
}
392393

@@ -2504,8 +2505,8 @@ mod tests {
25042505

25052506
#[test]
25062507
fn test_write_f64() {
2507-
assert_eq!(F64(3.0).to_string().into_string(), "3");
2508-
assert_eq!(F64(3.0).to_pretty_str().into_string(), "3");
2508+
assert_eq!(F64(3.0).to_string().into_string(), "3.0");
2509+
assert_eq!(F64(3.0).to_pretty_str().into_string(), "3.0");
25092510

25102511
assert_eq!(F64(3.1).to_string().into_string(), "3.1");
25112512
assert_eq!(F64(3.1).to_pretty_str().into_string(), "3.1");

0 commit comments

Comments
 (0)