Skip to content

Commit

Permalink
💥 unwrap
Browse files Browse the repository at this point in the history
  • Loading branch information
ChanTsune committed Nov 18, 2024
1 parent 743d263 commit a942142
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
6 changes: 3 additions & 3 deletions cli/src/command/commons.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ pub(crate) fn collect_items<I: IntoIterator<Item = P>, P: Into<PathBuf>>(
}
};
for path in walker.into_iter().flatten() {
let path = path?.into_path();
let path = path.unwrap().into_path();
if keep_dir || path.is_file() {
target_items.push(path);
}
Expand Down Expand Up @@ -183,7 +183,7 @@ pub(crate) fn apply_metadata(
owner_options: OwnerOptions,
) -> io::Result<EntryBuilder> {
if keep_options.keep_timestamp || keep_options.keep_permission {
let meta = fs::metadata(path)?;
let meta = fs::metadata(path).unwrap();
if keep_options.keep_timestamp {
if let Ok(c) = meta.created() {
if let Ok(created_since_unix_epoch) = c.duration_since(UNIX_EPOCH) {
Expand Down Expand Up @@ -274,7 +274,7 @@ pub(crate) fn apply_metadata(
}
#[cfg(unix)]
if keep_options.keep_xattr {
for attr in utils::os::unix::fs::xattrs::get_xattrs(path)? {
for attr in utils::os::unix::fs::xattrs::get_xattrs(path).unwrap() {
entry.add_xattr(attr);
}
}
Expand Down
18 changes: 10 additions & 8 deletions cli/src/command/create.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,11 @@ fn create_archive(args: CreateCommand) -> anyhow::Result<()> {
args.gitignore,
args.follow_links,
exclude,
)?;
)
.unwrap();

if let Some(parent) = archive.parent() {
fs::create_dir_all(parent)?;
fs::create_dir_all(parent).unwrap();
}
let max_file_size = args
.split
Expand Down Expand Up @@ -188,7 +189,8 @@ fn create_archive(args: CreateCommand) -> anyhow::Result<()> {
owner_options,
args.solid,
target_items,
)?;
)
.unwrap();
}
log::info!(
"Successfully created an archive in {}",
Expand All @@ -209,7 +211,7 @@ where
W: Write,
F: FnMut() -> io::Result<W>,
{
let pool = ThreadPoolBuilder::default().build()?;
let pool = ThreadPoolBuilder::default().build().unwrap();

let (tx, rx) = std::sync::mpsc::channel();
let option = if solid {
Expand All @@ -235,17 +237,17 @@ where

drop(tx);

let file = get_writer()?;
let file = get_writer().unwrap();
if solid {
let mut writer = Archive::write_solid_header(file, write_option)?;
let mut writer = Archive::write_solid_header(file, write_option).unwrap();
for entry in rx.into_iter() {
writer.add_entry(entry?)?;
writer.add_entry(entry.unwrap())?;
}
writer.finalize()?;
} else {
let mut writer = Archive::write_header(file)?;
for entry in rx.into_iter() {
writer.add_entry(entry?)?;
writer.add_entry(entry.unwrap())?;
}
writer.finalize()?;
}
Expand Down

0 comments on commit a942142

Please sign in to comment.