Skip to content

Commit 7ea1b85

Browse files
remove some lint ignores
- fix deflate feature flag in test
1 parent 8dd83d3 commit 7ea1b85

File tree

4 files changed

+17
-25
lines changed

4 files changed

+17
-25
lines changed

benches/read_metadata.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ fn parse_large_non_zip(bench: &mut Bencher) {
124124
let dir = TempDir::with_prefix("large-non-zip-bench").unwrap();
125125
let file = dir.path().join("zeros");
126126
let buf = vec![0u8; FILE_SIZE];
127-
fs::write(&file, &buf).unwrap();
127+
fs::write(&file, buf).unwrap();
128128

129129
bench.iter(|| {
130130
assert!(zip::ZipArchive::new(std::fs::File::open(&file).unwrap()).is_err());

src/read/pipelining.rs

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
//! Pipelined extraction into a filesystem directory.
22
3-
#![allow(clippy::needless_lifetimes)]
4-
#![allow(unknown_lints)]
5-
#![allow(non_local_definitions)]
63
#![cfg_attr(not(unix), allow(dead_code))]
74

85
pub mod path_splitting {
@@ -83,7 +80,7 @@ pub mod path_splitting {
8380
pub children: BTreeMap<&'a str, Box<FSEntry<'a, Data>>>,
8481
}
8582

86-
impl<'a, Data> Default for DirEntry<'a, Data> {
83+
impl<Data> Default for DirEntry<'_, Data> {
8784
fn default() -> Self {
8885
Self {
8986
properties: None,
@@ -404,16 +401,16 @@ pub mod handle_creation {
404401
}
405402
}
406403

407-
impl<'a> cmp::PartialEq for ZipDataHandle<'a> {
404+
impl cmp::PartialEq for ZipDataHandle<'_> {
408405
#[inline(always)]
409406
fn eq(&self, other: &Self) -> bool {
410407
self.ptr() == other.ptr()
411408
}
412409
}
413410

414-
impl<'a> cmp::Eq for ZipDataHandle<'a> {}
411+
impl cmp::Eq for ZipDataHandle<'_> {}
415412

416-
impl<'a> hash::Hash for ZipDataHandle<'a> {
413+
impl hash::Hash for ZipDataHandle<'_> {
417414
#[inline(always)]
418415
fn hash<H: hash::Hasher>(&self, state: &mut H) {
419416
self.ptr().hash(state);
@@ -1159,12 +1156,9 @@ pub mod split_extraction {
11591156
zip.add_directory("a/b", opts.unix_permissions(0o500))
11601157
.unwrap();
11611158

1162-
zip.start_file(
1163-
"d/e",
1164-
opts.compression_method(CompressionMethod::Deflated)
1165-
.unix_permissions(0o755),
1166-
)
1167-
.unwrap();
1159+
#[cfg(feature = "_deflate-any")]
1160+
let opts = opts.compression_method(CompressionMethod::Deflated);
1161+
zip.start_file("d/e", opts.unix_permissions(0o755)).unwrap();
11681162
zip.write_all(b"ffasedfasjkef").unwrap();
11691163

11701164
/* Create readable archive and extraction dir. */

src/read/split.rs

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
//! Traits for splitting and teeing file contents into multiple parallel streams.
22
3-
#![allow(clippy::needless_lifetimes)]
43
#![cfg_attr(not(unix), allow(dead_code))]
54

65
macro_rules! interruptible_buffered_io_op {
@@ -230,13 +229,13 @@ pub mod file {
230229
}
231230
}
232231

233-
impl<'fd> FixedFile for FileInput<'fd> {
232+
impl FixedFile for FileInput<'_> {
234233
fn extent(&self) -> u64 {
235234
self.extent
236235
}
237236
}
238237

239-
impl<'fd> InputFile for FileInput<'fd> {
238+
impl InputFile for FileInput<'_> {
240239
fn pread(&self, start: u64, buf: &mut [MaybeUninit<u8>]) -> io::Result<usize> {
241240
let count = self.range_len(start, buf.len())?;
242241

@@ -300,7 +299,7 @@ pub mod file {
300299
_ph: PhantomData<&'infd u8>,
301300
}
302301

303-
impl<'infd, 'buf> FileBufferCopy<'infd, 'buf> {
302+
impl<'buf> FileBufferCopy<'_, 'buf> {
304303
pub fn new(buf: &'buf mut [u8]) -> Self {
305304
assert!(!buf.is_empty());
306305
Self {
@@ -369,7 +368,6 @@ pub mod file {
369368
Ok(i)
370369
}
371370

372-
#[allow(clippy::missing_transmute_annotations)]
373371
#[test]
374372
fn pread() {
375373
let i = readable_file(b"asdf").unwrap();
@@ -379,12 +377,12 @@ pub mod file {
379377
let mut buf: [MaybeUninit<u8>; 10] = unsafe { mem::transmute(buf) };
380378
assert_eq!(2, ii.pread(0, &mut buf[..2]).unwrap());
381379
assert_eq!(
382-
unsafe { mem::transmute::<_, &[u8]>(&buf[..2]) },
380+
unsafe { mem::transmute::<&[mem::MaybeUninit<u8>], &[u8]>(&buf[..2]) },
383381
b"as".as_ref()
384382
);
385383
assert_eq!(3, ii.pread(1, &mut buf[4..]).unwrap());
386384
assert_eq!(
387-
unsafe { mem::transmute::<_, &[u8]>(&buf[..]) },
385+
unsafe { mem::transmute::<&[mem::MaybeUninit<u8>], &[u8]>(&buf[..]) },
388386
&[b'a', b's', 0, 0, b's', b'd', b'f', 0, 0, 0]
389387
);
390388
}
@@ -445,7 +443,7 @@ pub mod file {
445443

446444
pub struct FileCopy<'infd>(PhantomData<&'infd u8>);
447445

448-
impl<'infd> FileCopy<'infd> {
446+
impl FileCopy<'_> {
449447
pub const fn new() -> Self {
450448
Self(PhantomData)
451449
}
@@ -729,7 +727,7 @@ pub mod pipe {
729727
_ph: PhantomData<&'infd u8>,
730728
}
731729

732-
impl<'infd, 'buf> PipeWriteBufferSplicer<'infd, 'buf> {
730+
impl<'buf> PipeWriteBufferSplicer<'_, 'buf> {
733731
#[allow(dead_code)]
734732
pub fn new(buf: &'buf mut [u8]) -> Self {
735733
assert!(!buf.is_empty());
@@ -931,7 +929,7 @@ pub mod pipe {
931929

932930
pub struct PipeWriteSplicer<'infd>(PhantomData<&'infd u8>);
933931

934-
impl<'infd> PipeWriteSplicer<'infd> {
932+
impl PipeWriteSplicer<'_> {
935933
pub const fn new() -> Self {
936934
Self(PhantomData)
937935
}

tests/extract_symlink.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ fn extract_should_respect_links() {
1414
let symlink_path = temp_dir.path().join("pandoc-3.2-arm64/bin/pandoc-lua");
1515

1616
// Read the target of the symbolic link
17-
let target_path = fs::read_link(&symlink_path).unwrap();
17+
let target_path = fs::read_link(symlink_path).unwrap();
1818

1919
assert_eq!(target_path, PathBuf::from_str("pandoc").unwrap());
2020
}

0 commit comments

Comments
 (0)