diff --git a/Cargo.lock b/Cargo.lock index 8b79617..4b987e5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,7 +1,5 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 - [[package]] name = "arrayvec" version = "0.5.2" diff --git a/src/files.rs b/src/files.rs index 9342067..b41e897 100644 --- a/src/files.rs +++ b/src/files.rs @@ -150,7 +150,7 @@ pub fn scan_from_walkdir( // split the entries into chunks of 32, and iterate over each chunk of entries in a separate thread return entries .par_chunks(CHUNKS) - .flat_map(|chunk| { + .flat_map_iter(|chunk| { chunk .iter() // iter over the chunk, which is a slice of DirEntry structs .map(|entry| scan_file(entry, canonical_paths)) diff --git a/src/main.rs b/src/main.rs index b21e6c3..5da5c3b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -123,12 +123,16 @@ fn main() { for result in &results { match result { Ok(r) => { - debug!( - "{:?} is of type {}, should have extension \"{}\"", - r.file, - r.mime, - r.recommended_extension().unwrap_or_else(|| "???".into()) - ); + // check to see if debug logging is enabled before invoking debug! macro + // https://github.com/rust-lang/log/pull/394#issuecomment-630490343 + if log::max_level() >= log::Level::Debug { + debug!( + "{:?} is of type {}, should have extension \"{}\"", + r.file, + r.mime, + r.recommended_extension().unwrap_or_else(|| "???".into()) + ); + } } Err(f) => warn!("{}", f), }