Skip to content

Commit 858414b

Browse files
improved solution for function is_non_auto_or_matches
1 parent fee5cd1 commit 858414b

File tree

1 file changed

+11
-13
lines changed
  • src/tools/tidy/src/extra_checks

1 file changed

+11
-13
lines changed

src/tools/tidy/src/extra_checks/mod.rs

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -720,21 +720,19 @@ impl ExtraCheckArg {
720720
if !self.auto {
721721
return true;
722722
}
723-
match self.lang {
723+
let exts: &[&str] = match self.lang {
724+
ExtraCheckLang::Py => &[".py"],
725+
ExtraCheckLang::Cpp => &[".cpp"],
726+
ExtraCheckLang::Shell => &[".sh"],
727+
ExtraCheckLang::Js => &[".js", ".ts"],
724728
ExtraCheckLang::Spellcheck => {
725-
SPELLCHECK_DIRS.iter().any(|dir| Path::new(filepath).starts_with(dir))
726-
}
727-
lang => {
728-
let exts: &[&str] = match lang {
729-
ExtraCheckLang::Py => &[".py"],
730-
ExtraCheckLang::Cpp => &[".cpp"],
731-
ExtraCheckLang::Shell => &[".sh"],
732-
ExtraCheckLang::Js => &[".js", ".ts"],
733-
ExtraCheckLang::Spellcheck => unreachable!(),
734-
};
735-
exts.iter().any(|ext| filepath.ends_with(ext))
729+
if SPELLCHECK_DIRS.iter().any(|dir| Path::new(filepath).starts_with(dir)) {
730+
return true;
731+
}
732+
&[]
736733
}
737-
}
734+
};
735+
exts.iter().any(|ext| filepath.ends_with(ext))
738736
}
739737

740738
fn has_supported_kind(&self) -> bool {

0 commit comments

Comments
 (0)