diff options
author | softprops <d.tangren@gmail.com> | 2017-06-25 21:29:32 -0400 |
---|---|---|
committer | softprops <d.tangren@gmail.com> | 2017-06-25 21:29:32 -0400 |
commit | 6d784b1e4f7da7bbe837d32f040a37634208e73c (patch) | |
tree | a13627f8e5f2c7f805640e90a1a4ff7dfb57e373 /src/tarball.rs | |
parent | fe51ec45f98f215a7158bf64b9f10b80ce04e720 (diff) |
apply rustfmt
Diffstat (limited to 'src/tarball.rs')
-rw-r--r-- | src/tarball.rs | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/tarball.rs b/src/tarball.rs index d430279..21b5113 100644 --- a/src/tarball.rs +++ b/src/tarball.rs @@ -8,11 +8,13 @@ use tar::Archive; // todo: this is pretty involved. (re)factor this into its own crate pub fn dir<W>(buf: W, path: &str) -> io::Result<()> - where W: Write +where + W: Write, { let archive = Archive::new(GzEncoder::new(buf, Compression::Best)); fn bundle<F>(dir: &Path, f: &F, bundle_dir: bool) -> io::Result<()> - where F: Fn(&Path) -> io::Result<()> + where + F: Fn(&Path) -> io::Result<()>, { if fs::metadata(dir)?.is_dir() { if bundle_dir { @@ -43,11 +45,16 @@ pub fn dir<W>(buf: W, path: &str) -> io::Result<()> let append = |path: &Path| { let canonical = path.canonicalize()?; // todo: don't unwrap - let relativized = canonical.to_str().unwrap().trim_left_matches(&base_path_str[..]); + let relativized = canonical.to_str().unwrap().trim_left_matches( + &base_path_str[..], + ); if path.is_dir() { archive.append_dir(Path::new(relativized), &canonical)? } else { - archive.append_file(Path::new(relativized), &mut File::open(&canonical)?)? + archive.append_file( + Path::new(relativized), + &mut File::open(&canonical)?, + )? } Ok(()) }; |