minor cleanup

This commit is contained in:
Lynne Megido 2021-04-26 22:32:43 +10:00
parent 889b2e2316
commit 40bdac274f
Signed by: lynnesbian
GPG Key ID: F0A184B5213D9F90
3 changed files with 8 additions and 6 deletions

View File

@ -1,6 +1,6 @@
#!/bin/bash
fd -e rs -x touch {}
cargo clippy --all-targets --all-features -- \
cargo clippy --all-features -- \
-W clippy::nursery \
-W clippy::perf \
-W clippy::pedantic \

View File

@ -27,8 +27,6 @@ use clap::Clap;
use env_logger::Env;
use log::{debug, error, info, trace, warn};
use once_cell::sync::OnceCell;
#[cfg(feature = "multi-threaded")]
use rayon::prelude::*;
use walkdir::{DirEntry, WalkDir};
use crate::findings::Findings;
@ -256,6 +254,8 @@ fn scan_file(entry: &DirEntry) -> Result<Findings, ScanError> {
fn scan_from_walkdir(entries: &[DirEntry]) -> Vec<Result<Findings, ScanError>> {
cfg_if! {
if #[cfg(feature = "multi-threaded")] {
use rayon::prelude::*;
// rather than using a standard par_iter, split the entries into chunks of 32 first.
// this allows each spawned thread to handle 32 files before before closing, rather than creating a new thread for
// each file. this leads to a pretty substantial speedup that i'm pretty substantially happy about 0u0

View File

@ -116,11 +116,14 @@ impl Parameters {
}
pub fn default_verbosity(&self) -> &'static str {
#![allow(clippy::missing_const_for_fn)]
// match was not permitted inside const functions until 1.46
match self.verbose {
0 => "warn",
1 => "info",
2 => "debug",
3 | _ => "trace",
_ => "trace",
}
}
}
@ -159,7 +162,7 @@ impl ExtensionSet {
Self::Audio.extensions(),
Self::Videos.extensions(),
]
.concat(),
.concat(),
Self::Documents => vec![
"pdf", "doc", "docx", "ppt", "pptx", "xls", "xlsx", "csv", "tsv", "odt", "ods", "odp", "oda", "rtf", "ps",
"pages", "key", "numbers",
@ -175,4 +178,3 @@ impl ExtensionSet {
}
}
}