De-~[] Mem{Reader,Writer}

This commit is contained in:
Steven Fackler 2014-03-26 22:46:25 -07:00
parent d0e60b72ee
commit 49a8081095
21 changed files with 66 additions and 65 deletions

View file

@ -154,7 +154,7 @@ fn main() {
let rdr = if os::getenv("RUST_BENCH").is_some() {
let foo = include_bin!("shootout-k-nucleotide.data");
~MemReader::new(foo.to_owned()) as ~Reader
~MemReader::new(Vec::from_slice(foo)) as ~Reader
} else {
~stdio::stdin() as ~Reader
};

View file

@ -174,7 +174,7 @@ fn test_write() {
writeln!(w, "{foo}", foo="bar");
}
let s = str::from_utf8_owned(buf.unwrap()).unwrap();
let s = str::from_utf8(buf.unwrap().as_slice()).unwrap().to_owned();
t!(s, "34helloline\nbar\n");
}
@ -198,7 +198,7 @@ fn test_format_args() {
format_args!(|args| { fmt::write(w, args); }, "test");
format_args!(|args| { fmt::write(w, args); }, "{test}", test=3);
}
let s = str::from_utf8_owned(buf.unwrap()).unwrap();
let s = str::from_utf8(buf.unwrap().as_slice()).unwrap().to_owned();
t!(s, "1test3");
let s = format_args!(fmt::format, "hello {}", "world");