File tree Expand file tree Collapse file tree 1 file changed +13
-13
lines changed Expand file tree Collapse file tree 1 file changed +13
-13
lines changed Original file line number Diff line number Diff line change @@ -720,21 +720,21 @@ impl ExtraCheckArg {
720720 if !self . auto {
721721 return true ;
722722 }
723- let ext = match self . lang {
724- ExtraCheckLang :: Py => ".py" ,
725- ExtraCheckLang :: Cpp => ".cpp" ,
726- ExtraCheckLang :: Shell => ".sh" ,
727- ExtraCheckLang :: Js => ".js" ,
723+ match self . lang {
728724 ExtraCheckLang :: Spellcheck => {
729- for dir in SPELLCHECK_DIRS {
730- if Path :: new ( filepath) . starts_with ( dir) {
731- return true ;
732- }
733- }
734- return false ;
725+ SPELLCHECK_DIRS . iter ( ) . any ( |dir| Path :: new ( filepath) . starts_with ( dir) )
735726 }
736- } ;
737- filepath. ends_with ( ext)
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) )
736+ }
737+ }
738738 }
739739
740740 fn has_supported_kind ( & self ) -> bool {
You can’t perform that action at this time.
0 commit comments