chore: fix clippy warnings

This commit is contained in:
Michel de Graaf
2025-06-29 22:16:17 +02:00
parent 78ac774e82
commit b69be1c6f0
15 changed files with 506 additions and 504 deletions
+10 -10
View File
@@ -71,8 +71,8 @@ fn round_one_operations(
mut b: u32,
mut c: u32,
mut d: u32,
table: &Vec<u32>,
x: &Vec<u32>,
table: &[u32],
x: &[u32],
) -> [u32; 4] {
let _ = x;
let _ = table;
@@ -119,8 +119,8 @@ fn round_two_operations(
mut b: u32,
mut c: u32,
mut d: u32,
table: &Vec<u32>,
x: &Vec<u32>,
table: &[u32],
x: &[u32],
) -> [u32; 4] {
macro_rules! round2 {
( $a:ident, $b:ident, $c:ident, $d:ident, $k:expr, $s:expr, $i:expr) => {
@@ -165,8 +165,8 @@ fn round_three_operations(
mut b: u32,
mut c: u32,
mut d: u32,
table: &Vec<u32>,
x: &Vec<u32>,
table: &[u32],
x: &[u32],
) -> [u32; 4] {
macro_rules! round3 {
( $a:ident, $b:ident, $c:ident, $d:ident, $k:expr, $s:expr, $i:expr ) => {
@@ -211,8 +211,8 @@ fn round_four_operations(
mut b: u32,
mut c: u32,
mut d: u32,
table: &Vec<u32>,
x: &Vec<u32>,
table: &[u32],
x: &[u32],
) -> [u32; 4] {
macro_rules! round4 {
( $a:ident, $b:ident, $c:ident, $d:ident, $k:expr, $s:expr, $i:expr ) => {
@@ -260,8 +260,8 @@ fn convert_u8_chunk_to_u32(chunk: &mut [u8]) -> Vec<u32> {
// iterate over our block and take
// our 8 bit ints and convert them to
// 32 bit integers
for i in 0..chunk.len() {
temporary_vec.push(chunk[i]);
for item in chunk {
temporary_vec.push(*item);
count += 1;
if count == 4 {
let temp_arr: [u8; 4] = vec_to_array(temporary_vec.clone());
+4 -8
View File
@@ -291,15 +291,11 @@ fn decode_trees(r: &mut BitReader) -> Result<(HuffmanTree, HuffmanTree), String>
} else if sym == 17 {
// repeat code length 0 for 3..10 times. (3 bits of length)
let repeat_length = r.read_bits(3)? + 3;
for _ in 0..repeat_length {
bl.push(0);
}
bl.resize(bl.len() + repeat_length as usize, 0);
} else if sym == 18 {
// repeat code length 0 for 11..138 times. (7 bits of length)
let repeat_length = r.read_bits(7)? + 11;
for _ in 0..repeat_length {
bl.push(0);
}
bl.resize(bl.len() + repeat_length as usize, 0);
} else {
return Err("Invalid symbol".to_string());
}
@@ -362,8 +358,8 @@ mod tests {
#[test]
fn test_extract_header_success() {
let data = vec![120, 156]; // Valid zlib header
let result = deflate(&vec![120, 156, 3, 0, 0, 0, 0, 1]); // Minimal valid zlib stream
let _data = [120, 156]; // Valid zlib header
let result = deflate(&[120, 156, 3, 0, 0, 0, 0, 1]); // Minimal valid zlib stream
assert!(result.is_ok());
}