fix: clippy warnings

This commit is contained in:
oxalica 2025-07-02 02:47:32 -04:00
parent bef287039a
commit 40c1c1f4e1

View File

@ -90,7 +90,7 @@ pub fn unpack_archive(archive: FilesystemReader<'_>, output_folder: &Path, quiet
let target = &symlink.link; let target = &symlink.link;
#[cfg(unix)] #[cfg(unix)]
{ {
std::os::unix::fs::symlink(&target, &file_path)?; std::os::unix::fs::symlink(target, &file_path)?;
filetime_creation::set_symlink_file_times(&file_path, mtime, mtime, mtime)?; filetime_creation::set_symlink_file_times(&file_path, mtime, mtime, mtime)?;
// Note: Symlink permissions are ignored on *NIX anyway. No need to set them. // Note: Symlink permissions are ignored on *NIX anyway. No need to set them.
} }
@ -138,6 +138,8 @@ pub fn unpack_archive(archive: FilesystemReader<'_>, output_folder: &Path, quiet
Ok(unpacked_files) Ok(unpacked_files)
} }
// Re-assignments work bettwe with `cfg` blocks.
#[allow(clippy::field_reassign_with_default)]
pub fn build_archive_from_paths<W>( pub fn build_archive_from_paths<W>(
input_filenames: &[PathBuf], input_filenames: &[PathBuf],
output_path: &Path, output_path: &Path,
@ -258,7 +260,7 @@ where
} }
if !quiet { if !quiet {
info(format!("Compressing data")); info("Compressing data".to_string());
} }
// Finalize the superblock and write data. This should be done before // Finalize the superblock and write data. This should be done before
@ -330,7 +332,7 @@ impl io::Read for LazyFile {
} }
LazyFile::Opened(file) => { LazyFile::Opened(file) => {
let cnt = file.read(buf)?; let cnt = file.read(buf)?;
if buf.len() != 0 && cnt == 0 { if !buf.is_empty() && cnt == 0 {
*self = Self::Closed; *self = Self::Closed;
} }
Ok(cnt) Ok(cnt)