diff --git a/src/build.rs b/src/build.rs index 1f281d0..835edcb 100644 --- a/src/build.rs +++ b/src/build.rs @@ -3,7 +3,7 @@ // SPDX-License-Identifier: MIT OR Apache-2.0 fn main() { - find_libarchive() + find_libarchive(); } #[cfg(not(target_env = "msvc"))] diff --git a/src/ffi/locale.rs b/src/ffi/locale.rs index fc54453..a40e54d 100644 --- a/src/ffi/locale.rs +++ b/src/ffi/locale.rs @@ -39,10 +39,10 @@ mod inner { ) }; - let save = if !utf8_locale.is_null() { - unsafe { libc::uselocale(utf8_locale) } - } else { + let save = if utf8_locale.is_null() { std::ptr::null_mut() + } else { + unsafe { libc::uselocale(utf8_locale) } }; Self { save, utf8_locale } diff --git a/src/iterator.rs b/src/iterator.rs index 5d1d0d5..257096b 100644 --- a/src/iterator.rs +++ b/src/iterator.rs @@ -1,7 +1,6 @@ use std::{ ffi::{CStr, CString}, io::{Read, Seek, SeekFrom, Write}, - ops::DerefMut, slice, }; @@ -38,6 +37,7 @@ pub enum ArchiveContents { } /// An iterator over the contents of an archive. +#[allow(clippy::module_name_repetitions)] pub struct ArchiveIterator { archive_entry: *mut ffi::archive_entry, archive_reader: *mut ffi::archive, @@ -168,7 +168,7 @@ impl ArchiveIterator { archive_result( ffi::archive_read_open( archive_reader, - (pipe.deref_mut() as *mut HeapReadSeekerPipe) as *mut c_void, + std::ptr::addr_of_mut!(*pipe) as *mut c_void, None, Some(libarchive_heap_seekableread_callback::), None, diff --git a/src/lib.rs b/src/lib.rs index 306aa68..d74adb9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -72,6 +72,7 @@ use std::{ const READER_BUFFER_SIZE: usize = 16384; /// Determine the ownership behavior when unpacking the archive. +#[derive(Clone, Copy, Debug)] pub enum Ownership { /// Preserve the ownership of the files when uncompressing the archive. Preserve, @@ -456,7 +457,7 @@ where archive_result( ffi::archive_read_open( archive_reader, - (&mut pipe as *mut SeekableReaderPipe) as *mut c_void, + std::ptr::addr_of_mut!(pipe) as *mut c_void, None, Some(libarchive_seekable_read_callback), None, @@ -513,7 +514,7 @@ where archive_result( ffi::archive_read_open( archive_reader, - (&mut pipe as *mut ReaderPipe) as *mut c_void, + std::ptr::addr_of_mut!(pipe) as *mut c_void, None, Some(libarchive_read_callback), None,