minor cleanup
This commit is contained in:
parent
889b2e2316
commit
40bdac274f
3 changed files with 8 additions and 6 deletions
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
fd -e rs -x touch {}
|
fd -e rs -x touch {}
|
||||||
cargo clippy --all-targets --all-features -- \
|
cargo clippy --all-features -- \
|
||||||
-W clippy::nursery \
|
-W clippy::nursery \
|
||||||
-W clippy::perf \
|
-W clippy::perf \
|
||||||
-W clippy::pedantic \
|
-W clippy::pedantic \
|
||||||
|
|
|
@ -27,8 +27,6 @@ use clap::Clap;
|
||||||
use env_logger::Env;
|
use env_logger::Env;
|
||||||
use log::{debug, error, info, trace, warn};
|
use log::{debug, error, info, trace, warn};
|
||||||
use once_cell::sync::OnceCell;
|
use once_cell::sync::OnceCell;
|
||||||
#[cfg(feature = "multi-threaded")]
|
|
||||||
use rayon::prelude::*;
|
|
||||||
use walkdir::{DirEntry, WalkDir};
|
use walkdir::{DirEntry, WalkDir};
|
||||||
|
|
||||||
use crate::findings::Findings;
|
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>> {
|
fn scan_from_walkdir(entries: &[DirEntry]) -> Vec<Result<Findings, ScanError>> {
|
||||||
cfg_if! {
|
cfg_if! {
|
||||||
if #[cfg(feature = "multi-threaded")] {
|
if #[cfg(feature = "multi-threaded")] {
|
||||||
|
use rayon::prelude::*;
|
||||||
|
|
||||||
// rather than using a standard par_iter, split the entries into chunks of 32 first.
|
// 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
|
// 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
|
// each file. this leads to a pretty substantial speedup that i'm pretty substantially happy about 0u0
|
||||||
|
|
|
@ -116,11 +116,14 @@ impl Parameters {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn default_verbosity(&self) -> &'static str {
|
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 {
|
match self.verbose {
|
||||||
0 => "warn",
|
0 => "warn",
|
||||||
1 => "info",
|
1 => "info",
|
||||||
2 => "debug",
|
2 => "debug",
|
||||||
3 | _ => "trace",
|
_ => "trace",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -159,7 +162,7 @@ impl ExtensionSet {
|
||||||
Self::Audio.extensions(),
|
Self::Audio.extensions(),
|
||||||
Self::Videos.extensions(),
|
Self::Videos.extensions(),
|
||||||
]
|
]
|
||||||
.concat(),
|
.concat(),
|
||||||
Self::Documents => vec![
|
Self::Documents => vec![
|
||||||
"pdf", "doc", "docx", "ppt", "pptx", "xls", "xlsx", "csv", "tsv", "odt", "ods", "odp", "oda", "rtf", "ps",
|
"pdf", "doc", "docx", "ppt", "pptx", "xls", "xlsx", "csv", "tsv", "odt", "ods", "odp", "oda", "rtf", "ps",
|
||||||
"pages", "key", "numbers",
|
"pages", "key", "numbers",
|
||||||
|
@ -175,4 +178,3 @@ impl ExtensionSet {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue