Skip to content

Commit 94712c9

Browse files
committed
Follow hlint suggestion: redundant bracket
- Redundant bracket in Cabal-described - Redundant bracket in Cabal-syntax - Redundant bracket in Cabal - Redundant bracket in cabal-install-solver - Redundant bracket in cabal-install - Redundant bracket in Cabal-QuickCheck - Redundant bracket in Cabal-tests - Redundant bracket in cabal-testsuite - Update counts with hlint --default - Realign vertically - Fix formatting by putting all on one line - Follow hlint suggestion: use section - Don't apply HLint suggestions to Z modules - Hold off changing the Z modules
1 parent a51c4ee commit 94712c9

112 files changed

Lines changed: 293 additions & 303 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.hlint.yaml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
# Warnings currently triggered by your code
22
- ignore: {name: "Avoid NonEmpty.unzip"} # 1 hint
33
- ignore: {name: "Avoid lambda"} # 54 hints
4-
- ignore: {name: "Eta reduce"} # 137 hints
4+
- ignore: {name: "Eta reduce"} # 139 hints
55
- ignore: {name: "Hoist not"} # 16 hints
66
- ignore: {name: "Move filter"} # 4 hints
77
- ignore: {name: "Redundant $!"} # 3 hints
8-
- ignore: {name: "Redundant bracket"} # 255 hints
98
- ignore: {name: "Redundant guard"} # 1 hint
109
- ignore: {name: "Redundant if"} # 6 hints
1110
- ignore: {name: "Redundant lambda"} # 16 hints
@@ -29,6 +28,14 @@
2928
- ignore: {name: "Functor law", within: [Test.Laws]}
3029
- ignore: {name: "Monoid law, left identity", within: [Test.Laws, UnitTests.Distribution.Utils.NubList]}
3130
- ignore: {name: "Monoid law, right identity", within: [Test.Laws, UnitTests.Distribution.Utils.NubList]}
31+
# Changing the Z modules will change the "Meta checks" CI job and fail its
32+
# "Check diff is clean" test. Wait until the 3.18 release before making changes
33+
# to these modules.
34+
- ignore:
35+
name: "Redundant bracket"
36+
within:
37+
- Distribution.Simple.Build.PathsModule.Z
38+
- Distribution.Simple.Build.Macros.Z
3239
- ignore: {name: "Replace case with maybe", within: [Distribution.Client.InLibrary]}
3340
- ignore: {name: "Use fmap", within: [Distribution.Client.HttpUtils, Distribution.Simple.SrcDist]}
3441
- ignore: {name: "Use fold", within: [Test.Laws]}

Cabal-QuickCheck/src/Test/QuickCheck/Instances/Cabal.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ instance Arbitrary PackageName where
6565
arbitrary = mkPackageName . intercalate "-" <$> shortListOf1 2 nameComponent
6666
where
6767
nameComponent = shortListOf1 5 (elements packageChars)
68-
`suchThat` (liftA2 (&&) (not . all isDigit) (/= "all"))
68+
`suchThat` liftA2 (&&) (not . all isDigit) (/= "all")
6969
packageChars = filter isAlphaNum ['\0'..'\127']
7070

7171
instance Arbitrary PackageIdentifier where

Cabal-described/src/Distribution/Described.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ instance Described IncludeRenaming where
426426
mr = describe (Proxy :: Proxy ModuleRenaming)
427427

428428
instance Described Language where
429-
describe _ = REUnion $ (REString . show) <$> reverse knownLanguages
429+
describe _ = REUnion $ REString . show <$> reverse knownLanguages
430430

431431
instance Described LegacyExeDependency where
432432
describe _ = RETodo

Cabal-syntax/src/Distribution/Fields/ConfVar.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ parser = condOr
154154
updatePosition :: P.SourcePos -> SectionArg Position -> [SectionArg Position] -> P.SourcePos
155155
updatePosition x s _ =
156156
let Position line col = sectionArgAnn s
157-
in P.setSourceLine (P.setSourceColumn x col) (line)
157+
in P.setSourceLine (P.setSourceColumn x col) line
158158
prettySectionArg = show
159159

160160
fromParsec :: Parsec a => Parser a

Cabal-syntax/src/Distribution/Fields/LexerMonad.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ returnLex a = Lex $ \s -> LexResult s a
149149

150150
{-# INLINE thenLex #-}
151151
thenLex :: Lex a -> (a -> Lex b) -> Lex b
152-
(Lex m) `thenLex` k = Lex $ \s -> case m s of LexResult s' a -> (unLex (k a)) s'
152+
(Lex m) `thenLex` k = Lex $ \s -> case m s of LexResult s' a -> unLex (k a) s'
153153

154154
setPos :: Position -> Lex ()
155155
setPos pos = Lex $ \s -> LexResult s{curPos = pos} ()

Cabal-syntax/src/Distribution/Fields/ParseResult.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ liftParseResult f pr = unPR pr emptyPRState initialCtx failure success
9494
pr' <- f a
9595
return $ PR $ \s' ctx failure' success' -> unPR pr' (concatPRState s s') ctx failure' success'
9696
concatPRState (PRState warnings errors version) (PRState warnings' errors' version') =
97-
(PRState (warnings ++ warnings') (toList errors ++ errors') (version <|> version'))
97+
PRState (warnings ++ warnings') (toList errors ++ errors') (version <|> version')
9898

9999
withSource :: src -> ParseResult src a -> ParseResult src a
100100
withSource source (PR pr) = PR $ \s ctx failure success ->

Cabal-syntax/src/Distribution/Fields/Parser.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ sectionLayoutOrBraces ilevel =
322322
closeBrace
323323
return elems
324324
)
325-
<|> (elements ilevel)
325+
<|> elements ilevel
326326

327327
-- The body of a field, using either inline style or braces.
328328
--

Cabal-syntax/src/Distribution/PackageDescription/PrettyPrint.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ ppCondBenchmarks v suites =
185185
ppCondition :: Condition ConfVar -> Doc
186186
ppCondition (Var x) = ppConfVar x
187187
ppCondition (Lit b) = text (show b)
188-
ppCondition (CNot c) = char '!' <<>> (ppCondition c)
188+
ppCondition (CNot c) = char '!' <<>> ppCondition c
189189
ppCondition (COr c1 c2) =
190190
parens
191191
( hsep

Cabal-syntax/src/Distribution/Types/GenericPackageDescription/Lens.hs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,23 +52,23 @@ condLibrary :: Lens' GenericPackageDescription (Maybe (CondTree ConfVar Library)
5252
condLibrary f s = fmap (\x -> s{T.condLibrary = x}) (f (T.condLibrary s))
5353
{-# INLINE condLibrary #-}
5454

55-
condSubLibraries :: Lens' GenericPackageDescription [(UnqualComponentName, (CondTree ConfVar Library))]
55+
condSubLibraries :: Lens' GenericPackageDescription [(UnqualComponentName, CondTree ConfVar Library)]
5656
condSubLibraries f s = fmap (\x -> s{T.condSubLibraries = x}) (f (T.condSubLibraries s))
5757
{-# INLINE condSubLibraries #-}
5858

59-
condForeignLibs :: Lens' GenericPackageDescription [(UnqualComponentName, (CondTree ConfVar ForeignLib))]
59+
condForeignLibs :: Lens' GenericPackageDescription [(UnqualComponentName, CondTree ConfVar ForeignLib)]
6060
condForeignLibs f s = fmap (\x -> s{T.condForeignLibs = x}) (f (T.condForeignLibs s))
6161
{-# INLINE condForeignLibs #-}
6262

63-
condExecutables :: Lens' GenericPackageDescription [(UnqualComponentName, (CondTree ConfVar Executable))]
63+
condExecutables :: Lens' GenericPackageDescription [(UnqualComponentName, CondTree ConfVar Executable)]
6464
condExecutables f s = fmap (\x -> s{T.condExecutables = x}) (f (T.condExecutables s))
6565
{-# INLINE condExecutables #-}
6666

67-
condTestSuites :: Lens' GenericPackageDescription [(UnqualComponentName, (CondTree ConfVar TestSuite))]
67+
condTestSuites :: Lens' GenericPackageDescription [(UnqualComponentName, CondTree ConfVar TestSuite)]
6868
condTestSuites f s = fmap (\x -> s{T.condTestSuites = x}) (f (T.condTestSuites s))
6969
{-# INLINE condTestSuites #-}
7070

71-
condBenchmarks :: Lens' GenericPackageDescription [(UnqualComponentName, (CondTree ConfVar Benchmark))]
71+
condBenchmarks :: Lens' GenericPackageDescription [(UnqualComponentName, CondTree ConfVar Benchmark)]
7272
condBenchmarks f s = fmap (\x -> s{T.condBenchmarks = x}) (f (T.condBenchmarks s))
7373
{-# INLINE condBenchmarks #-}
7474

Cabal-syntax/src/Distribution/Types/VersionRange/Internal.hs

Lines changed: 25 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -365,25 +365,23 @@ versionRangeParser digitParser csv = expr
365365
P.spaces
366366
t <- term
367367
P.spaces
368-
( do
369-
_ <- P.string "||"
370-
checkOp
371-
P.spaces
372-
e <- expr
373-
return (unionVersionRanges t e)
374-
<|> return t
375-
)
368+
do
369+
_ <- P.string "||"
370+
checkOp
371+
P.spaces
372+
e <- expr
373+
return (unionVersionRanges t e)
374+
<|> return t
376375
term = do
377376
f <- factor
378377
P.spaces
379-
( do
380-
_ <- P.string "&&"
381-
checkOp
382-
P.spaces
383-
t <- term
384-
return (intersectVersionRanges f t)
385-
<|> return f
386-
)
378+
do
379+
_ <- P.string "&&"
380+
checkOp
381+
P.spaces
382+
t <- term
383+
return (intersectVersionRanges f t)
384+
<|> return f
387385
factor = parens expr <|> prim
388386

389387
prim = do
@@ -392,21 +390,19 @@ versionRangeParser digitParser csv = expr
392390
"-" -> anyVersion <$ P.string "any" <|> P.string "none" *> noVersion'
393391
"==" -> do
394392
P.spaces
395-
( do
396-
(wild, v) <- verOrWild
397-
checkWild wild
398-
pure $ (if wild then withinVersion else thisVersion) v
399-
<|> (verSet' thisVersion =<< verSet)
400-
)
393+
do
394+
(wild, v) <- verOrWild
395+
checkWild wild
396+
pure $ (if wild then withinVersion else thisVersion) v
397+
<|> (verSet' thisVersion =<< verSet)
401398
"^>=" -> do
402399
P.spaces
403-
( do
404-
(wild, v) <- verOrWild
405-
when wild $
406-
P.unexpected "wild-card version after ^>= operator"
407-
majorBoundVersion' v
408-
<|> (verSet' majorBoundVersion =<< verSet)
409-
)
400+
do
401+
(wild, v) <- verOrWild
402+
when wild $
403+
P.unexpected "wild-card version after ^>= operator"
404+
majorBoundVersion' v
405+
<|> (verSet' majorBoundVersion =<< verSet)
410406
_ -> do
411407
P.spaces
412408
(wild, v) <- verOrWild

0 commit comments

Comments
 (0)