mirror of https://github.com/sharkdp/fd.git
Only construct entry_path if needed
This commit is contained in:
parent
40d811c7be
commit
631931b431
|
@ -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()) {
|
||||
|
|
Loading…
Reference in New Issue