]> git.lizzy.rs Git - rust.git/commitdiff
auto merge of #14932 : Sawyer47/rust/json-smallfix, r=huonw
authorbors <bors@rust-lang.org>
Mon, 16 Jun 2014 13:16:44 +0000 (13:16 +0000)
committerbors <bors@rust-lang.org>
Mon, 16 Jun 2014 13:16:44 +0000 (13:16 +0000)
src/libserialize/json.rs

index 436e969c48c92d04b938346b896d36d3bea5e5c3..f2717f6f263e6e3a39028986e2657aea77f1bb90 100644 (file)
@@ -350,11 +350,7 @@ fn escape_str(s: &str) -> String {
 }
 
 fn spaces(n: uint) -> String {
-    let mut ss = String::new();
-    for _ in range(0, n) {
-        ss.push_str(" ");
-    }
-    return ss
+    String::from_char(n, ' ')
 }
 
 /// A structure for implementing serialization to JSON.