diff options
Diffstat (limited to 'cli/tools/lint.rs')
-rw-r--r-- | cli/tools/lint.rs | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/cli/tools/lint.rs b/cli/tools/lint.rs index b7ae88e4f..4a7e0115e 100644 --- a/cli/tools/lint.rs +++ b/cli/tools/lint.rs @@ -112,27 +112,25 @@ pub async fn lint( let resolver = |changed: Option<Vec<PathBuf>>| { let files_changed = changed.is_some(); - let collect_files = - collect_files(&include_files, &exclude_files, is_supported_ext); + let result = + collect_files(&include_files, &exclude_files, is_supported_ext).map( + |files| { + if let Some(paths) = changed { + files + .iter() + .any(|path| paths.contains(path)) + .then(|| files) + .unwrap_or_else(|| [].to_vec()) + } else { + files + } + }, + ); let paths_to_watch = include_files.clone(); - let (result, should_relint) = match collect_files { - Ok(value) => { - if let Some(paths) = changed { - ( - Ok(value.clone()), - Some(value.iter().any(|path| paths.contains(path))), - ) - } else { - (Ok(value), None) - } - } - Err(e) => (Err(e), None), - }; - async move { - if files_changed && matches!(should_relint, Some(false)) { + if files_changed && matches!(result, Ok(ref files) if files.is_empty()) { ResolutionResult::Ignore } else { ResolutionResult::Restart { |