diff options
author | Akshat Agarwal <humancalico@disroot.org> | 2020-11-12 01:23:55 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-11 20:53:55 +0100 |
commit | c744ee2756d9cd812d47650fae52ef855cea9e53 (patch) | |
tree | 4635e5f1b45aed6afe418137aba958c107c2f2f7 /cli/lint.rs | |
parent | a55e689e389bf8a80639e31c217873d27b471a40 (diff) |
fix(cli): don't walk the subdirectory twice when using the `--ignore` flag (#8040)
This commit reworks "collect_files" utility to accept "ignore" parameter
which allows to filter out files in a single iteration instead of walking
file tree second time to excude "ignored" files.
Diffstat (limited to 'cli/lint.rs')
-rw-r--r-- | cli/lint.rs | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/cli/lint.rs b/cli/lint.rs index ff63b693c..ff156f785 100644 --- a/cli/lint.rs +++ b/cli/lint.rs @@ -47,13 +47,7 @@ pub async fn lint_files( if args.len() == 1 && args[0].to_string_lossy() == "-" { return lint_stdin(json); } - let mut target_files = collect_files(args)?; - if !ignore.is_empty() { - // collect all files to be ignored - // and retain only files that should be linted. - let ignore_files = collect_files(ignore)?; - target_files.retain(|f| !ignore_files.contains(&f)); - } + let target_files = collect_files(args, ignore)?; debug!("Found {} files", target_files.len()); let target_files_len = target_files.len(); |