From a94214288b63170adb23c67ed98647522d4454ac Mon Sep 17 00:00:00 2001 From: ChanTsune <41658782+ChanTsune@users.noreply.github.com> Date: Tue, 8 Oct 2024 16:29:51 +0900 Subject: [PATCH] :boom: unwrap --- cli/src/command/commons.rs | 6 +++--- cli/src/command/create.rs | 18 ++++++++++-------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/cli/src/command/commons.rs b/cli/src/command/commons.rs index 4aa4cd07..a7f6086e 100644 --- a/cli/src/command/commons.rs +++ b/cli/src/command/commons.rs @@ -101,7 +101,7 @@ pub(crate) fn collect_items, P: Into>( } }; 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); } @@ -183,7 +183,7 @@ pub(crate) fn apply_metadata( owner_options: OwnerOptions, ) -> io::Result { 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) { @@ -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); } } diff --git a/cli/src/command/create.rs b/cli/src/command/create.rs index a038a979..707e9cc5 100644 --- a/cli/src/command/create.rs +++ b/cli/src/command/create.rs @@ -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 @@ -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 {}", @@ -209,7 +211,7 @@ where W: Write, F: FnMut() -> io::Result, { - let pool = ThreadPoolBuilder::default().build()?; + let pool = ThreadPoolBuilder::default().build().unwrap(); let (tx, rx) = std::sync::mpsc::channel(); let option = if solid { @@ -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()?; }