diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2013-10-13 18:48:47 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2013-10-24 14:21:57 -0700 |
| commit | 61ed2cfb5516f76487509766b1054275f1340f70 (patch) | |
| tree | 815c604da80638dfc659220ee9f697b074954f47 /src/librustdoc/rustdoc.rs | |
| parent | 4eb53360541baf3e6df36dc0f0766bc7c1c9f8be (diff) | |
| download | rust-61ed2cfb5516f76487509766b1054275f1340f70.tar.gz rust-61ed2cfb5516f76487509766b1054275f1340f70.zip | |
Remove even more of std::io
Big fish fried here:
extra::json
most of the compiler
extra::io_util removed
extra::fileinput removed
Fish left to fry
extra::ebml
Diffstat (limited to 'src/librustdoc/rustdoc.rs')
| -rw-r--r-- | src/librustdoc/rustdoc.rs | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/librustdoc/rustdoc.rs b/src/librustdoc/rustdoc.rs index 4c53fe48fe1..c0fab1ad98f 100644 --- a/src/librustdoc/rustdoc.rs +++ b/src/librustdoc/rustdoc.rs @@ -28,6 +28,9 @@ use std::local_data; use std::rt::io::Writer; use std::rt::io::file::FileInfo; use std::rt::io; +use std::rt::io::mem::MemWriter; +use std::rt::io::Decorator; +use std::str; use extra::getopts; use extra::getopts::groups; use extra::json; @@ -257,11 +260,11 @@ fn rust_input(cratefile: &str, matches: &getopts::Matches) -> Output { /// This input format purely deserializes the json output file. No passes are /// run over the deserialized output. fn json_input(input: &str) -> Result<Output, ~str> { - let input = match ::std::io::file_reader(&Path::new(input)) { - Ok(i) => i, - Err(s) => return Err(s), + let input = match Path::new(input).open_reader(io::Open) { + Some(f) => f, + None => return Err(format!("couldn't open {} for reading", input)), }; - match json::from_reader(input) { + match json::from_reader(@mut input as @mut io::Reader) { Err(s) => Err(s.to_str()), Ok(json::Object(obj)) => { let mut obj = obj; @@ -306,8 +309,10 @@ fn json_output(crate: clean::Crate, res: ~[plugins::PluginJson], dst: Path) { // FIXME #8335: yuck, Rust -> str -> JSON round trip! No way to .encode // straight to the Rust JSON representation. - let crate_json_str = do std::io::with_str_writer |w| { - crate.encode(&mut json::Encoder(w)); + let crate_json_str = { + let w = @mut MemWriter::new(); + crate.encode(&mut json::Encoder(w as @mut io::Writer)); + str::from_utf8(*w.inner_ref()) }; let crate_json = match json::from_str(crate_json_str) { Ok(j) => j, |
