diff options
author | andy.boot <bootandy@gmail.com> | 2023-01-04 21:24:57 +0000 |
---|---|---|
committer | andy.boot <bootandy@gmail.com> | 2023-01-04 21:24:57 +0000 |
commit | 15845dee3e72efed55224777396ec81513d7a92c (patch) | |
tree | 5a23258f7a95eb4f2c6cf3831dce282286e9b331 | |
parent | 57115bd624faa51aa9d18731a763ae0afaeb2de3 (diff) |
refactor: cleanup codelinks
-rw-r--r-- | src/dir_walker.rs | 41 |
1 files changed, 20 insertions, 21 deletions
diff --git a/src/dir_walker.rs b/src/dir_walker.rs index 02255be..5f619f3 100644 --- a/src/dir_walker.rs +++ b/src/dir_walker.rs @@ -143,28 +143,27 @@ fn walk( // return walk(entry.path(), permissions_flag, ignore_directories, allowed_filesystems, use_apparent_size, by_filecount, ignore_hidden); - if !ignore_file(entry, walk_data) { - if let Ok(data) = entry.file_type() { - if data.is_symlink() && walk_data.ignore_links { - return None; - } - return if data.is_dir() || (walk_data.follow_links && data.is_symlink()) - { - walk(entry.path(), permissions_flag, walk_data, depth + 1) - } else { - build_node( - entry.path(), - vec![], - walk_data.filter_regex, - walk_data.invert_filter_regex, - walk_data.use_apparent_size, - data.is_symlink(), - data.is_file(), - walk_data.by_filecount, - depth, - ) - }; + if ignore_file(entry, walk_data) { + return None; + } + if let Ok(data) = entry.file_type() { + if data.is_symlink() && walk_data.ignore_links { + return None; + } + if data.is_dir() || (walk_data.follow_links && data.is_symlink()) { + return walk(entry.path(), permissions_flag, walk_data, depth + 1); } + return build_node( + entry.path(), + vec![], + walk_data.filter_regex, + walk_data.invert_filter_regex, + walk_data.use_apparent_size, + data.is_symlink(), + data.is_file(), + walk_data.by_filecount, + depth, + ); } } else { permissions_flag.store(true, atomic::Ordering::Relaxed); |