diff options
author | Jorge Aparicio <japaricious@gmail.com> | 2015-03-06 08:18:35 -0500 |
---|---|---|
committer | Jorge Aparicio <japaricious@gmail.com> | 2015-03-06 08:20:39 -0500 |
commit | d00e6d6e5dffa1454d0656e4d5a3f165e0814ed8 (patch) | |
tree | 0f549de88ca890ac58cbaef5407837cc6cdfbece | |
parent | d54fe74319a41a668a4ce967908118152a144052 (diff) |
update to rust nightly
-rw-r--r-- | src/bin/bindgen.rs | 17 | ||||
-rw-r--r-- | src/lib.rs | 3 |
2 files changed, 11 insertions, 9 deletions
diff --git a/src/bin/bindgen.rs b/src/bin/bindgen.rs index a3a8ad83..24381e44 100644 --- a/src/bin/bindgen.rs +++ b/src/bin/bindgen.rs @@ -6,11 +6,12 @@ extern crate bindgen; extern crate syntax; use bindgen::{Bindings, BindgenOptions, LinkType, Logger}; -use std::old_io as io; -use std::old_path as path; +use std::io; +use std::path; use std::env; use std::default::Default; -use std::old_io::fs; +use std::old_io; +use std::fs; struct StdLogger; @@ -26,7 +27,7 @@ impl Logger for StdLogger { enum ParseResult { CmdUsage, - ParseOk(BindgenOptions, Box<io::Writer+'static>), + ParseOk(BindgenOptions, Box<io::Write+'static>), ParseErr(String) } @@ -34,7 +35,7 @@ fn parse_args(args: &[String]) -> ParseResult { let args_len = args.len(); let mut options: BindgenOptions = Default::default(); - let mut out = Box::new(io::BufferedWriter::new(io::stdout())) as Box<io::Writer>; + let mut out = Box::new(io::BufWriter::new(io::stdout())) as Box<io::Write>; if args_len == 0 { return ParseResult::CmdUsage; @@ -58,9 +59,9 @@ fn parse_args(args: &[String]) -> ParseResult { if ix + 1 >= args_len { return ParseResult::ParseErr("Missing output filename".to_string()); } - let path = path::Path::new(&args[ix + 1].clone()); + let path = path::Path::new(&args[ix + 1]); match fs::File::create(&path) { - Ok(f) => { out = Box::new(io::BufferedWriter::new(f)) as Box<io::Writer>; } + Ok(f) => { out = Box::new(io::BufWriter::new(f)) as Box<io::Write>; } Err(_) => { return ParseResult::ParseErr(format!("Open {} failed", args[ix + 1])); } } ix += 2; @@ -154,7 +155,7 @@ Options: Options other than stated above are passed to clang. " ); - io::stdio::print(&s[]); + old_io::stdio::print(&s[]); } pub fn main() { @@ -10,6 +10,7 @@ extern crate libc; use std::collections::HashSet; use std::default::Default; use std::old_io::IoResult; +use std::io::{Write, self}; use syntax::ast; use syntax::codemap::{DUMMY_SP, Span}; @@ -114,7 +115,7 @@ impl Bindings }) } - pub fn write(&self, writer: &mut (Writer + 'static)) -> IoResult<()> { + pub fn write(&self, writer: &mut (Write + 'static)) -> io::Result<()> { try!(writer.write("/* automatically generated by rust-bindgen */\n\n".as_bytes())); // This is safe as the Box<Writer> does not outlive ps or this function |