Only construct entry_path if needed

This commit is contained in:
sharkdp 2018-02-25 11:34:26 +01:00 committed by David Peter
parent 40d811c7be
commit 631931b431
1 changed files with 2 additions and 2 deletions

View File

@ -191,8 +191,6 @@ pub fn scan(path_vec: &[PathBuf], pattern: Arc<Regex>, config: Arc<FdOptions>) {
Err(_) => return ignore::WalkState::Continue,
};
let entry_path = entry.path();
if entry.depth() == 0 {
return ignore::WalkState::Continue;
}
@ -211,6 +209,8 @@ pub fn scan(path_vec: &[PathBuf], pattern: Arc<Regex>, config: Arc<FdOptions>) {
}
}
let entry_path = entry.path();
// Filter out unwanted extensions.
if let Some(ref exts_regex) = config.extensions {
if let Some(path_str) = entry_path.file_name().map_or(None, |s| s.to_str()) {