mirror of
https://github.com/sharkdp/fd.git
synced 2024-11-17 17:35:16 +01:00
Remove duplicated lstat
syscall
Removes a unnecessary `lstat` syscall by calling `.metadata()` only once. This makes `--type executable` searches about 15% faster.
This commit is contained in:
parent
6fb5004b85
commit
641976cf7a
1 changed files with 4 additions and 3 deletions
|
@ -219,9 +219,10 @@ pub fn scan(path_vec: &[PathBuf], pattern: Arc<Regex>, config: Arc<FdOptions>) {
|
|||
if (entry_type.is_file() && !file_types.files)
|
||||
|| (entry_type.is_dir() && !file_types.directories)
|
||||
|| (entry_type.is_symlink() && !file_types.symlinks)
|
||||
|| (entry.metadata().is_ok()
|
||||
&& !fshelper::is_executable(&entry.metadata().unwrap())
|
||||
&& file_types.executables_only)
|
||||
|| (file_types.executables_only && !entry
|
||||
.metadata()
|
||||
.map(|m| fshelper::is_executable(&m))
|
||||
.unwrap_or(false))
|
||||
{
|
||||
return ignore::WalkState::Continue;
|
||||
} else if !(entry_type.is_file()
|
||||
|
|
Loading…
Reference in a new issue