diff options
| author | Adolfo OchagavĂa <aochagavia92@gmail.com> | 2014-06-28 19:28:29 +0200 |
|---|---|---|
| committer | Adolfo OchagavĂa <aochagavia92@gmail.com> | 2014-06-30 21:35:49 +0200 |
| commit | 035914edcfb19bf531eb633fba54c68b53fbe8d8 (patch) | |
| tree | b6dd09ca6548d9a4f1b58e37cd307e7eeca67016 | |
| parent | fb96cbba4185772dae47f3f3bddbaa8698426d93 (diff) | |
| download | rust-035914edcfb19bf531eb633fba54c68b53fbe8d8.tar.gz rust-035914edcfb19bf531eb633fba54c68b53fbe8d8.zip | |
Fix issues in librustdoc
| -rw-r--r-- | src/librustdoc/lib.rs | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index 46aa6cb5e94..86b80ee2494 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -408,18 +408,17 @@ fn json_output(krate: clean::Crate, res: Vec<plugins::PluginJson> , // "crate": { parsed crate ... }, // "plugins": { output of plugins ... } // } - let mut json = box std::collections::TreeMap::new(); - json.insert("schema".to_string(), - json::String(SCHEMA_VERSION.to_string())); - let plugins_json = box res.move_iter() - .filter_map(|opt| { - match opt { - None => None, - Some((string, json)) => { - Some((string.to_string(), json)) - } + let mut json = std::collections::TreeMap::new(); + json.insert("schema".to_string(), json::String(SCHEMA_VERSION.to_string())); + let plugins_json = res.move_iter() + .filter_map(|opt| { + match opt { + None => None, + Some((string, json)) => { + Some((string.to_string(), json)) } - }).collect(); + } + }).collect(); // FIXME #8335: yuck, Rust -> str -> JSON round trip! No way to .encode // straight to the Rust JSON representation. @@ -429,7 +428,7 @@ fn json_output(krate: clean::Crate, res: Vec<plugins::PluginJson> , let mut encoder = json::Encoder::new(&mut w as &mut io::Writer); krate.encode(&mut encoder).unwrap(); } - str::from_utf8(w.unwrap().as_slice()).unwrap().to_string() + str::from_utf8_owned(w.unwrap()).unwrap() }; let crate_json = match json::from_str(crate_json_str.as_slice()) { Ok(j) => j, @@ -440,6 +439,5 @@ fn json_output(krate: clean::Crate, res: Vec<plugins::PluginJson> , json.insert("plugins".to_string(), json::Object(plugins_json)); let mut file = try!(File::create(&dst)); - try!(json::Object(json).to_writer(&mut file)); - Ok(()) + json::Object(json).to_writer(&mut file) } |
