Skip to content

Commit bf30dea

Browse files
committed
---
yaml --- r: 161660 b: refs/heads/snap-stage3 c: fec0f16 h: refs/heads/master v: v3
1 parent fcf7323 commit bf30dea

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
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 4eb72d268f337a8f117c86a2ac1b98336cab9e9d
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: f102123b659911dbee25bbe518d73d66185bb978
4+
refs/heads/snap-stage3: fec0f16c98ab066ff11be35b5a8bb0d80efa90f1
55
refs/heads/try: 0f0d21c1eb5c7be04d323e0b06faf252ad790af6
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d

branches/snap-stage3/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)