diff --git a/Cargo.toml b/Cargo.toml index fe2658b37..254bad04a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -26,7 +26,7 @@ docopt = "0.8.1" env_logger = "0.4" failure = "0.1.1" filetime = "0.1" -flate2 = "0.2" +flate2 = "1.0" fs2 = "0.4" git2 = "0.6" git2-curl = "0.7" diff --git a/src/cargo/ops/cargo_package.rs b/src/cargo/ops/cargo_package.rs index 84a20c641..b72793ae6 100644 --- a/src/cargo/ops/cargo_package.rs +++ b/src/cargo/ops/cargo_package.rs @@ -196,7 +196,7 @@ fn tar(ws: &Workspace, // Prepare the encoder and its header let filename = Path::new(filename); let encoder = GzBuilder::new().filename(util::path2bytes(filename)?) - .write(dst, Compression::Best); + .write(dst, Compression::best()); // Put all package files into a compressed archive let mut ar = Builder::new(encoder); @@ -282,7 +282,7 @@ fn run_verify(ws: &Workspace, tar: &FileLock, opts: &PackageOpts) -> CargoResult config.shell().status("Verifying", pkg)?; - let f = GzDecoder::new(tar.file())?; + let f = GzDecoder::new(tar.file()); let dst = tar.parent().join(&format!("{}-{}", pkg.name(), pkg.version())); if fs::metadata(&dst).is_ok() { fs::remove_dir_all(&dst)?; diff --git a/src/cargo/sources/registry/mod.rs b/src/cargo/sources/registry/mod.rs index 27984aa6c..16269a11d 100644 --- a/src/cargo/sources/registry/mod.rs +++ b/src/cargo/sources/registry/mod.rs @@ -323,7 +323,7 @@ impl<'cfg> RegistrySource<'cfg> { return Ok(dst) } - let gz = GzDecoder::new(tarball.file())?; + let gz = GzDecoder::new(tarball.file()); let mut tar = Archive::new(gz); let prefix = dst.file_name().unwrap(); let parent = dst.parent().unwrap(); diff --git a/tests/cross-publish.rs b/tests/cross-publish.rs index 4dd0c292a..b971d45a8 100644 --- a/tests/cross-publish.rs +++ b/tests/cross-publish.rs @@ -47,7 +47,7 @@ fn simple_cross_package() { // Check that the tarball contains the files let f = File::open(&p.root().join("target/package/foo-0.0.0.crate")).unwrap(); - let mut rdr = GzDecoder::new(f).unwrap(); + let mut rdr = GzDecoder::new(f); let mut contents = Vec::new(); rdr.read_to_end(&mut contents).unwrap(); let mut ar = Archive::new(&contents[..]); diff --git a/tests/package.rs b/tests/package.rs index 42a491ebf..6ba37e984 100644 --- a/tests/package.rs +++ b/tests/package.rs @@ -54,7 +54,7 @@ src[/]main.rs execs().with_status(0).with_stdout("")); let f = File::open(&p.root().join("target/package/foo-0.0.1.crate")).unwrap(); - let mut rdr = GzDecoder::new(f).unwrap(); + let mut rdr = GzDecoder::new(f); let mut contents = Vec::new(); rdr.read_to_end(&mut contents).unwrap(); let mut ar = Archive::new(&contents[..]); @@ -531,7 +531,7 @@ src[..]main.rs execs().with_status(0).with_stdout("")); let f = File::open(&p.root().join("target/package/nested-0.0.1.crate")).unwrap(); - let mut rdr = GzDecoder::new(f).unwrap(); + let mut rdr = GzDecoder::new(f); let mut contents = Vec::new(); rdr.read_to_end(&mut contents).unwrap(); let mut ar = Archive::new(&contents[..]); @@ -617,7 +617,7 @@ See [..] // Check that the tarball contains the added file let f = File::open(&p.root().join("target/package/foo-0.0.1.crate")).unwrap(); - let mut rdr = GzDecoder::new(f).unwrap(); + let mut rdr = GzDecoder::new(f); let mut contents = Vec::new(); rdr.read_to_end(&mut contents).unwrap(); let mut ar = Archive::new(&contents[..]); @@ -748,7 +748,7 @@ fn generated_manifest() { execs().with_status(0)); let f = File::open(&p.root().join("target/package/foo-0.0.1.crate")).unwrap(); - let mut rdr = GzDecoder::new(f).unwrap(); + let mut rdr = GzDecoder::new(f); let mut contents = Vec::new(); rdr.read_to_end(&mut contents).unwrap(); let mut ar = Archive::new(&contents[..]); @@ -827,7 +827,7 @@ fn ignore_workspace_specifier() { execs().with_status(0)); let f = File::open(&p.root().join("target/package/bar-0.1.0.crate")).unwrap(); - let mut rdr = GzDecoder::new(f).unwrap(); + let mut rdr = GzDecoder::new(f); let mut contents = Vec::new(); rdr.read_to_end(&mut contents).unwrap(); let mut ar = Archive::new(&contents[..]); diff --git a/tests/publish.rs b/tests/publish.rs index d4af2e99a..ac12aa8d3 100644 --- a/tests/publish.rs +++ b/tests/publish.rs @@ -54,8 +54,8 @@ See [..] f.seek(SeekFrom::Current(sz as i64 + 4)).unwrap(); // Verify the tarball - let mut rdr = GzDecoder::new(f).unwrap(); - assert_eq!(rdr.header().filename().unwrap(), b"foo-0.0.1.crate"); + let mut rdr = GzDecoder::new(f); + assert_eq!(rdr.header().unwrap().filename().unwrap(), b"foo-0.0.1.crate"); let mut contents = Vec::new(); rdr.read_to_end(&mut contents).unwrap(); let mut ar = Archive::new(&contents[..]); @@ -121,8 +121,8 @@ See [..] f.seek(SeekFrom::Current(sz as i64 + 4)).unwrap(); // Verify the tarball - let mut rdr = GzDecoder::new(f).unwrap(); - assert_eq!(rdr.header().filename().unwrap(), "foo-0.0.1.crate".as_bytes()); + let mut rdr = GzDecoder::new(f); + assert_eq!(rdr.header().unwrap().filename().unwrap(), "foo-0.0.1.crate".as_bytes()); let mut contents = Vec::new(); rdr.read_to_end(&mut contents).unwrap(); let mut ar = Archive::new(&contents[..]); @@ -189,8 +189,8 @@ See [..] f.seek(SeekFrom::Current(sz as i64 + 4)).unwrap(); // Verify the tarball - let mut rdr = GzDecoder::new(f).unwrap(); - assert_eq!(rdr.header().filename().unwrap(), "foo-0.0.1.crate".as_bytes()); + let mut rdr = GzDecoder::new(f); + assert_eq!(rdr.header().unwrap().filename().unwrap(), "foo-0.0.1.crate".as_bytes()); let mut contents = Vec::new(); rdr.read_to_end(&mut contents).unwrap(); let mut ar = Archive::new(&contents[..]);