mirror of
https://github.com/sharkdp/fd.git
synced 2024-11-18 18:00:35 +01:00
Use short-circuiting for --type
searches
Reverses the order of boolean checks for `--type` searches, making them about 10% to 50% faster(!).
This commit is contained in:
parent
641976cf7a
commit
50a2bab5cd
1 changed files with 3 additions and 3 deletions
|
@ -216,9 +216,9 @@ pub fn scan(path_vec: &[PathBuf], pattern: Arc<Regex>, config: Arc<FdOptions>) {
|
|||
|
||||
if let Some(ref file_types) = config.file_types {
|
||||
if let Some(ref entry_type) = entry.file_type() {
|
||||
if (entry_type.is_file() && !file_types.files)
|
||||
|| (entry_type.is_dir() && !file_types.directories)
|
||||
|| (entry_type.is_symlink() && !file_types.symlinks)
|
||||
if (!file_types.files && entry_type.is_file())
|
||||
|| (!file_types.directories && entry_type.is_dir())
|
||||
|| (!file_types.symlinks && entry_type.is_symlink())
|
||||
|| (file_types.executables_only && !entry
|
||||
.metadata()
|
||||
.map(|m| fshelper::is_executable(&m))
|
||||
|
|
Loading…
Reference in a new issue