diff --git a/src/creator/mod.rs b/src/creator/mod.rs index 1595cb9..513dda8 100644 --- a/src/creator/mod.rs +++ b/src/creator/mod.rs @@ -5,7 +5,7 @@ use { borrow::BorrowMut, env, error::Error, - fs::{File, self}, + fs::{self, File}, io::{self, Write}, path::{Path, PathBuf}, sync::{ @@ -97,10 +97,7 @@ impl Creator { plist.lock().unwrap().borrow_mut().entries.push(item.entry); match writer.lock().unwrap().borrow_mut().write_all(&item.data) { Ok(_) => sender - .send(Message::MemberAdded(format!( - "{} added to archive", - path.display() - ))) + .send(Message::MemberAdded(format!("{}", path.display()))) .expect("couldn't send message"), Err(e) => sender .send(Message::Failure(format!("{e}"))) diff --git a/tar/src/header.rs b/tar/src/header.rs index fe37291..337cda4 100644 --- a/tar/src/header.rs +++ b/tar/src/header.rs @@ -5,8 +5,10 @@ use std::{ ffi::CStr, fmt::{self, Write}, fs::{self, Metadata}, + io, ops::Deref, - os::{linux::fs::MetadataExt, unix::fs::FileTypeExt}, path::PathBuf, io, + os::{linux::fs::MetadataExt, unix::fs::FileTypeExt}, + path::PathBuf, }; #[repr(u8)] @@ -225,11 +227,21 @@ impl Header { let path = PathBuf::from(&filename); let name = match path.file_name().and_then(|n| n.to_str()) { Some(n) => n.to_string(), - None => return Err(Error::Io(io::Error::new(io::ErrorKind::Other, "Cannot get file name"))), + None => { + return Err(Error::Io(io::Error::new( + io::ErrorKind::Other, + "Cannot get file name", + ))) + } }; let dir = match path.parent() { Some(d) => d, - None => return Err(Error::Io(io::Error::new(io::ErrorKind::Other, "Cannot get path prefix"))), + None => { + return Err(Error::Io(io::Error::new( + io::ErrorKind::Other, + "Cannot get path prefix", + ))) + } }; (name, Some(format!("{}", dir.display()))) }; @@ -288,11 +300,21 @@ impl Header { let path = PathBuf::from(&filename); let name = match path.file_name().and_then(|n| n.to_str()) { Some(n) => n.to_string(), - None => return Err(Error::Io(io::Error::new(io::ErrorKind::Other, "Cannot get file name"))), + None => { + return Err(Error::Io(io::Error::new( + io::ErrorKind::Other, + "Cannot get file name", + ))) + } }; let dir = match path.parent() { Some(d) => d, - None => return Err(Error::Io(io::Error::new(io::ErrorKind::Other, "Cannot get path prefix"))), + None => { + return Err(Error::Io(io::Error::new( + io::ErrorKind::Other, + "Cannot get path prefix", + ))) + } }; (name, Some(format!("{}", dir.display()))) };