From c744ee2756d9cd812d47650fae52ef855cea9e53 Mon Sep 17 00:00:00 2001 From: Akshat Agarwal Date: Thu, 12 Nov 2020 01:23:55 +0530 Subject: 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. --- cli/lint.rs | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'cli/lint.rs') 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(); -- cgit v1.2.3