From 379eb50f8d097581173c89cd3441448c3d7a93f9 Mon Sep 17 00:00:00 2001 From: Johan Andersson Date: Sat, 21 Oct 2023 23:45:58 +0200 Subject: [PATCH] Fix Clippy warnings --- test-compress/src/main.rs | 2 +- test-hash/src/main.rs | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/test-compress/src/main.rs b/test-compress/src/main.rs index f54b831..9699d29 100644 --- a/test-compress/src/main.rs +++ b/test-compress/src/main.rs @@ -1,4 +1,4 @@ -#![allow(unused_imports)] +#![allow(unused_imports, clippy::type_complexity)] use rayon::prelude::*; use std::{ diff --git a/test-hash/src/main.rs b/test-hash/src/main.rs index ee75e36..2d974e1 100644 --- a/test-hash/src/main.rs +++ b/test-hash/src/main.rs @@ -98,7 +98,7 @@ fn hashes() -> Vec<(&'static str, &'static str, Box Vec + S // md-5 ( "md-5", "MD5", Box::new(|b| { let mut hasher = md5_alt::Md5::new(); - hasher.update(&b); + hasher.update(b); hasher.finalize().to_vec() }) ), @@ -154,7 +154,7 @@ fn hashes() -> Vec<(&'static str, &'static str, Box Vec + S Box::new(|b| { use blake2::digest::{VariableOutputDirty, Update}; let mut hasher = blake2::VarBlake2b::new(32).unwrap(); - hasher.update(&b); + hasher.update(b); let mut t = vec![]; hasher.finalize_variable_dirty(|res| t = res.to_vec()); t @@ -200,8 +200,8 @@ fn hashes() -> Vec<(&'static str, &'static str, Box Vec + S }) ), - ( "bao", "bao-combined", Box::new(|b| bao::encode::encode(&b).1.as_bytes().to_vec()) ), - ( "bao", "bao-outboard", Box::new(|b| bao::encode::outboard(&b).1.as_bytes().to_vec()) ), + ( "bao", "bao-combined", Box::new(|b| bao::encode::encode(b).1.as_bytes().to_vec()) ), + ( "bao", "bao-outboard", Box::new(|b| bao::encode::outboard(b).1.as_bytes().to_vec()) ), // multihash @@ -316,8 +316,7 @@ fn perf_test(options: Options) { .build_global() .unwrap(); - let mut bytes = Vec::new(); - bytes.resize(options.size * 1024 * 1024, 0u8); + let bytes = vec![0u8; options.size * 1024 * 1024]; if options.format == Format::Csv { println!("implementation,hash,MB/s");