Skip to content

Commit e15eb1e

Browse files
authored
Merge pull request #49 from tamird/clippy
Fix lint errors
2 parents 127527d + 92a3f2e commit e15eb1e

File tree

4 files changed

+8
-14
lines changed

4 files changed

+8
-14
lines changed

benches/reversedbitreader_bench.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use ruzstd::decoding::bit_reader_reverse::BitReaderReversed;
55
fn do_all_accesses(br: &mut BitReaderReversed, accesses: &[u8]) -> u64 {
66
let mut sum = 0;
77
for x in accesses {
8-
sum += br.get_bits(*x).unwrap() as u64;
8+
sum += br.get_bits(*x).unwrap();
99
}
1010
let _ = black_box(br);
1111
sum

src/decoding/ringbuffer.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,8 +268,6 @@ impl RingBuffer {
268268
/// 2. More then len reserved space so we do not write out-of-bounds
269269
#[warn(unsafe_op_in_unsafe_fn)]
270270
pub unsafe fn extend_from_within_unchecked(&mut self, start: usize, len: usize) {
271-
debug_assert!(!self.buf.as_ptr().is_null());
272-
273271
if self.head < self.tail {
274272
// continous data slice |____HDDDDDDDT_____|
275273
let after_tail = usize::min(len, self.cap - self.tail);

src/tests/fuzz_regressions.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,10 @@ fn test_all_artifacts() {
1717
}
1818

1919
let mut f = File::open(file_name.clone()).unwrap();
20-
match frame_dec.reset(&mut f) {
21-
Ok(_) => {
22-
let _ = frame_dec.decode_blocks(&mut f, frame_decoder::BlockDecodingStrategy::All);
23-
/* ignore errors. It just should never panic on invalid input */
24-
}
25-
Err(_) => {} /* ignore errors. It just should never panic on invalid input */
26-
}
20+
21+
/* ignore errors. It just should never panic on invalid input */
22+
let _: Result<_, _> = frame_dec.reset(&mut f).and_then(|()| {
23+
frame_dec.decode_blocks(&mut f, frame_decoder::BlockDecodingStrategy::All)
24+
});
2725
}
2826
}

src/tests/mod.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -351,8 +351,7 @@ fn test_streaming_no_std() {
351351
let mut stream = crate::streaming_decoder::StreamingDecoder::new(&mut content).unwrap();
352352

353353
let original = include_bytes!("../../decodecorpus_files/z000088");
354-
let mut result = Vec::new();
355-
result.resize(original.len(), 0);
354+
let mut result = vec![0; original.len()];
356355
Read::read_exact(&mut stream, &mut result).unwrap();
357356

358357
if original.len() != result.len() {
@@ -391,8 +390,7 @@ fn test_streaming_no_std() {
391390
.unwrap();
392391

393392
let original = include_bytes!("../../decodecorpus_files/z000068");
394-
let mut result = Vec::new();
395-
result.resize(original.len(), 0);
393+
let mut result = vec![0; original.len()];
396394
Read::read_exact(&mut stream, &mut result).unwrap();
397395

398396
std::println!("Results for file:");

0 commit comments

Comments
 (0)