diff --git a/Cargo.toml b/Cargo.toml index a39e520..99ebd5e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,5 +18,4 @@ serde = { version = "1", features = ["derive"] } tokio = { version = "1", features = ["rt-multi-thread"] } [build-dependencies] -anyhow = "1" zip = { version = "0.6", default-features = false, features = ["deflate"] } diff --git a/build.rs b/build.rs index 6979e0f..b30c3be 100644 --- a/build.rs +++ b/build.rs @@ -1,31 +1,33 @@ -use anyhow::{ensure, Result}; use std::fs::File; use std::io; use std::path::{Path, PathBuf}; use std::process::Command; use zip::ZipWriter; -fn main() -> Result<()> { +fn main() { let out_dir = PathBuf::from(std::env::var_os("OUT_DIR").unwrap()); let output = Command::new("cargo") .args(["package", "--list", "--allow-dirty"]) - .output()?; - ensure!(output.status.success(), "unsuccessful"); + .output() + .unwrap(); + if !output.status.success() { + panic!("cargo package failed"); + } - let mut writer = ZipWriter::new(File::create(out_dir.join("source.zip"))?); - for path in String::from_utf8(output.stdout)?.lines() { + let mut writer = ZipWriter::new(File::create(out_dir.join("source.zip")).unwrap()); + for path in String::from_utf8(output.stdout).unwrap().lines() { if path == "Cargo.toml.orig" { continue; } - writer.start_file(path, Default::default())?; + writer.start_file(path, Default::default()).unwrap(); io::copy( - &mut File::open(Path::new(env!("CARGO_MANIFEST_DIR")).join(path))?, + &mut File::open(Path::new(env!("CARGO_MANIFEST_DIR")).join(path)).unwrap(), &mut writer, - )?; + ) + .unwrap(); } - writer.finish()?; - Ok(()) + writer.finish().unwrap(); }