diff --git a/src/bin/extract.rs b/src/bin/extract.rs index 1d9df0f0..795bfcb6 100644 --- a/src/bin/extract.rs +++ b/src/bin/extract.rs @@ -1,3 +1,5 @@ +#![allow(unstable)] + extern crate zip; fn main() @@ -8,14 +10,14 @@ fn main() std::os::set_exit_status(1); return; } - let fname = Path::new(args[1].as_slice()); + let fname = Path::new(&*args[1]); let file = std::io::File::open(&fname).unwrap(); let zipcontainer = zip::ZipReader::new(file).unwrap(); for file in zipcontainer.files() { - let outpath = sanitize_filename(file.file_name.as_slice()); + let outpath = sanitize_filename(&*file.file_name); println!("{}", outpath.display()); let comment = &file.file_comment; @@ -23,7 +25,7 @@ fn main() std::io::fs::mkdir_recursive(&outpath.dir_path(), std::io::USER_DIR).unwrap(); - if file.file_name.as_slice().ends_with("/") { + if (&*file.file_name).ends_with("/") { create_directory(outpath); } else { @@ -48,7 +50,7 @@ fn create_directory(outpath: Path) fn sanitize_filename(filename: &str) -> Path { let no_null_filename = match filename.find('\0') { - Some(index) => filename.slice_to(index), + Some(index) => &filename[0..index], None => filename, }; diff --git a/src/bin/extract_lorem.rs b/src/bin/extract_lorem.rs index 57b8a271..b790a0e5 100644 --- a/src/bin/extract_lorem.rs +++ b/src/bin/extract_lorem.rs @@ -1,3 +1,5 @@ +#![allow(unstable)] + extern crate zip; fn main() @@ -8,7 +10,7 @@ fn main() std::os::set_exit_status(1); return; } - let fname = Path::new(args[1].as_slice()); + let fname = Path::new(&*args[1]); let file = std::io::File::open(&fname).unwrap(); let zipcontainer = zip::ZipReader::new(file).unwrap(); diff --git a/src/bin/write_sample.rs b/src/bin/write_sample.rs index 155228eb..5be6b467 100644 --- a/src/bin/write_sample.rs +++ b/src/bin/write_sample.rs @@ -1,3 +1,5 @@ +#![allow(unstable)] + extern crate zip; fn main() @@ -9,7 +11,7 @@ fn main() return; } - let filename = args[1].as_slice(); + let filename = &*args[1]; match doit(filename) { Ok(_) => println!("File written to {}", filename),