diff --git a/crates/ruff_linter/src/settings/types.rs b/crates/ruff_linter/src/settings/types.rs index f74bbc3555..02ecb314c1 100644 --- a/crates/ruff_linter/src/settings/types.rs +++ b/crates/ruff_linter/src/settings/types.rs @@ -161,7 +161,7 @@ impl FilePattern { // Add basename path. if !pattern.contains(std::path::MAIN_SEPARATOR) { - builder.add(Glob::from_str(&pattern)?); + builder.add(Glob::new(&pattern)?); } } } diff --git a/crates/ruff_workspace/src/resolver.rs b/crates/ruff_workspace/src/resolver.rs index 6bf5671a3c..1f57a1504e 100644 --- a/crates/ruff_workspace/src/resolver.rs +++ b/crates/ruff_workspace/src/resolver.rs @@ -547,15 +547,17 @@ fn is_file_excluded( /// Return `true` if the given file should be ignored based on the exclusion /// criteria. +#[inline] pub fn match_exclusion, R: AsRef>( file_path: P, file_basename: R, exclusion: &GlobSet, ) -> bool { - if exclusion.is_empty() { - return false; - } - exclusion.is_match(file_path) || exclusion.is_match(file_basename) + match_candidate_exclusion( + &Candidate::new(file_path.as_ref()), + &Candidate::new(file_basename.as_ref()), + exclusion, + ) } /// Return `true` if the given candidates should be ignored based on the exclusion