File tree Expand file tree Collapse file tree 4 files changed +7
-12
lines changed
Cabal-syntax/src/Distribution/Utils
Cabal/src/Distribution/Simple/FileMonitor
cabal-install/src/Distribution/Client Expand file tree Collapse file tree 4 files changed +7
-12
lines changed Original file line number Diff line number Diff line change 4747- ignore : {name: "Use fromMaybe"} # 5 hints
4848- ignore : {name: "Use fst"} # 2 hints
4949- ignore : {name: "Use infix"} # 20 hints
50- - ignore : {name: "Use isAsciiLower"} # 2 hints
51- - ignore : {name: "Use isAsciiUpper"} # 2 hints
52- - ignore : {name: "Use isDigit"} # 2 hints
5350- ignore : {name: "Use lambda-case"} # 58 hints
5451- ignore : {name: "Use list comprehension"} # 19 hints
5552- ignore : {name: "Use list literal"} # 3 hints
Original file line number Diff line number Diff line change @@ -85,6 +85,7 @@ module Distribution.Utils.Generic
8585import Distribution.Compat.Prelude
8686import Prelude ()
8787
88+ import Data.Char (isAsciiLower , isAsciiUpper )
8889import Distribution.Utils.String
8990
9091import Data.Bits (shiftL , (.&.) , (.|.) )
@@ -449,9 +450,7 @@ isAscii c = fromEnum c < 0x80
449450
450451-- | Ascii letters.
451452isAsciiAlpha :: Char -> Bool
452- isAsciiAlpha c =
453- (' a' <= c && c <= ' z' )
454- || (' A' <= c && c <= ' Z' )
453+ isAsciiAlpha c = (isAsciiLower c) || (isAsciiUpper c)
455454
456455-- | Ascii letters and digits.
457456--
Original file line number Diff line number Diff line change @@ -39,6 +39,7 @@ import Distribution.Simple.Glob.Internal
3939import qualified Distribution.Compat.CharParsing as P
4040import Distribution.Parsec
4141import Distribution.Pretty
42+ import Distribution.Utils.Generic (isAsciiAlpha )
4243import qualified Text.PrettyPrint as Disp
4344
4445--------------------------------------------------------------------------------
@@ -211,7 +212,7 @@ instance Parsec FilePathRoot where
211212 root = FilePathRoot " /" <$ P. char ' /'
212213 home = FilePathHomeDir <$ P. string " ~/"
213214 drive = do
214- dr <- P. satisfy $ \ c -> (c >= ' a ' && c <= ' z ' ) || (c >= ' A ' && c <= ' Z ' )
215+ dr <- P. satisfy isAsciiAlpha
215216 _ <- P. char ' :'
216217 _ <- P. char ' /' <|> P. char ' \\ '
217218 return (FilePathRoot (toUpper dr : " :\\ " ))
Original file line number Diff line number Diff line change @@ -629,14 +629,13 @@ gitProgram =
629629 -- or annoyingly "git version 2.17.1.windows.2" yes, really
630630 (_ : _ : ver : _) ->
631631 intercalate " ."
632- . takeWhile (all isNum )
632+ . takeWhile (all isDigit )
633633 . split
634634 $ ver
635635 _ -> " "
636636 }
637637 where
638- isNum c = c >= ' 0' && c <= ' 9'
639- isTypical c = isNum c || c == ' .'
638+ isTypical c = isDigit c || c == ' .'
640639 split cs = case break (== ' .' ) cs of
641640 (chunk, [] ) -> chunk : []
642641 (chunk, _ : rest) -> chunk : split rest
@@ -924,5 +923,4 @@ pijulProgram =
924923 _ -> " "
925924 }
926925 where
927- isNum c = c >= ' 0' && c <= ' 9'
928- isTypical c = isNum c || c == ' .'
926+ isTypical c = isDigit c || c == ' .'
You can’t perform that action at this time.
0 commit comments