chore: fix all clippy warnings
All checks were successful
ci/woodpecker/push/build Pipeline was successful
ci/woodpecker/push/lint Pipeline was successful

This commit is contained in:
Jef Roosens 2024-07-08 21:54:12 +02:00
parent 9cec2e0dc2
commit fde56af414
Signed by: Jef Roosens
GPG key ID: 02D4C0997E74717B
13 changed files with 119 additions and 158 deletions

View file

@ -386,6 +386,7 @@ pub enum ExtractOption {
ClearNoChangeFFlags,
}
#[derive(Default)]
pub struct ExtractOptions {
pub flags: i32,
}
@ -420,9 +421,3 @@ impl ExtractOptions {
self
}
}
impl Default for ExtractOptions {
fn default() -> ExtractOptions {
ExtractOptions { flags: 0 }
}
}

View file

@ -78,7 +78,7 @@ impl Builder {
ffi::archive_read_support_filter_program_signature(
self.handle_mut(),
c_prog.as_ptr(),
mem::transmute(cb),
mem::transmute::<std::option::Option<extern "C" fn()>, *const std::ffi::c_void>(cb),
size,
)
}

View file

@ -41,7 +41,7 @@ impl FileWriter {
unsafe {
match ffi::archive_write_header(self.handle_mut(), entry.entry_mut()) {
ffi::ARCHIVE_OK => Ok(()),
_ => Err(ArchiveError::from(self as &dyn Handle).into()),
_ => Err(ArchiveError::from(self as &dyn Handle)),
}
}
}
@ -50,7 +50,7 @@ impl FileWriter {
unsafe {
match ffi::archive_write_header(self.handle_mut(), entry.entry_mut()) {
ffi::ARCHIVE_OK => (),
_ => return Err(ArchiveError::from(self as &dyn Handle).into()),
_ => return Err(ArchiveError::from(self as &dyn Handle)),
}
}
@ -74,7 +74,7 @@ impl FileWriter {
// Negative values signal errors
if res < 0 {
return Err(ArchiveError::from(self as &dyn Handle).into());
return Err(ArchiveError::from(self as &dyn Handle));
}
written += usize::try_from(res).unwrap();

View file

@ -30,6 +30,12 @@ impl Entry for WriteEntry {
}
}
impl Default for WriteEntry {
fn default() -> Self {
Self::new()
}
}
impl Drop for WriteEntry {
fn drop(&mut self) {
unsafe { ffi::archive_entry_free(self.entry_mut()) }