Skip to content

Commit 6ef8193

Browse files
authored
Merge pull request #11135 from cabalism/hlint/elem-notElem
Hlint use elem and use notElem
2 parents 3d16e4b + 6221bb7 commit 6ef8193

File tree

12 files changed

+14
-16
lines changed

12 files changed

+14
-16
lines changed

.hlint.yaml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
- ignore: {name: "Move guards forward"} # 4 hints
1515
- ignore: {name: "Redundant $"} # 202 hints
1616
- ignore: {name: "Redundant $!"} # 1 hint
17-
- ignore: {name: "Redundant <$>"} # 18 hints
18-
- ignore: {name: "Redundant bracket"} # 274 hints
17+
- ignore: {name: "Redundant <$>"} # 17 hints
18+
- ignore: {name: "Redundant bracket"} # 276 hints
1919
- ignore: {name: "Redundant guard"} # 2 hints
2020
- ignore: {name: "Redundant if"} # 6 hints
2121
- ignore: {name: "Redundant lambda"} # 19 hints
@@ -40,13 +40,12 @@
4040
- ignore: {name: "Use catMaybes"} # 4 hints
4141
- ignore: {name: "Use concatMap"} # 2 hints
4242
- ignore: {name: "Use const"} # 37 hints
43-
- ignore: {name: "Use elem"} # 2 hints
4443
- ignore: {name: "Use first"} # 5 hints
4544
- ignore: {name: "Use fmap"} # 24 hints
4645
- ignore: {name: "Use fold"} # 1 hint
4746
- ignore: {name: "Use fromMaybe"} # 5 hints
4847
- ignore: {name: "Use fst"} # 2 hints
49-
- ignore: {name: "Use infix"} # 20 hints
48+
- ignore: {name: "Use infix"} # 27 hints
5049
- ignore: {name: "Use lambda-case"} # 58 hints
5150
- ignore: {name: "Use list comprehension"} # 19 hints
5251
- ignore: {name: "Use list literal"} # 3 hints
@@ -57,7 +56,6 @@
5756
- ignore: {name: "Use max"} # 2 hints
5857
- ignore: {name: "Use maybe"} # 8 hints
5958
- ignore: {name: "Use newtype instead of data"} # 31 hints
60-
- ignore: {name: "Use notElem"} # 9 hints
6159
- ignore: {name: "Use null"} # 2 hints
6260
- ignore: {name: "Use record patterns"} # 16 hints
6361
- ignore: {name: "Use replicateM_"} # 2 hints

Cabal-syntax/src/Distribution/Types/PackageId.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ instance Parsec PackageIdentifier where
6565
(v, xs) <- case simpleParsec (NE.last xs') of
6666
Nothing -> return (nullVersion, toList xs') -- all components are version
6767
Just v -> return (v, NE.init xs')
68-
if not (null xs) && all (\c -> all (/= '.') c && not (all isDigit c)) xs
68+
if not (null xs) && all (\c -> notElem '.' c && not (all isDigit c)) xs
6969
then return $ PackageIdentifier (mkPackageName (intercalate "-" xs)) v
7070
else fail "all digits or a dot in a portion of package name"
7171
where

Cabal/src/Distribution/PackageDescription/Check.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ checkPackageDescription
423423
-- But it is OK for executables to have the same name.
424424
nsubs <- asksCM (pnSubLibs . ccNames)
425425
checkP
426-
(any (== prettyShow pn) (prettyShow <$> nsubs))
426+
(elem (prettyShow pn) (prettyShow <$> nsubs))
427427
(PackageBuildImpossible $ IllegalLibraryName pn)
428428

429429
-- § Fields check.

Cabal/src/Distribution/Simple/Configure.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -711,7 +711,7 @@ computeLocalBuildConfig cfg comp programDb = do
711711
-- rely on them. By the time that bug was fixed, ghci had
712712
-- been changed to read shared libraries instead of archive
713713
-- files (see next code block).
714-
not (GHC.compilerBuildWay comp `elem` [DynWay, ProfDynWay])
714+
notElem (GHC.compilerBuildWay comp) [DynWay, ProfDynWay]
715715
CompilerId GHCJS _ ->
716716
not (GHCJS.isDynamic comp)
717717
_ -> False

Cabal/src/Distribution/Simple/LocalBuildInfo.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ depLibraryPaths
320320
-- because you never have any internal libraries in this case;
321321
-- they're all external.
322322
let external_ipkgs = filter is_external (allPackages installed)
323-
is_external ipkg = not (installedUnitId ipkg `elem` internalDeps)
323+
is_external ipkg = notElem (installedUnitId ipkg) internalDeps
324324
-- First look for dynamic libraries in `dynamic-library-dirs`, and use
325325
-- `library-dirs` as a fall back.
326326
getDynDir pkg = case Installed.libraryDynDirs pkg of

Cabal/src/Distribution/Simple/SrcDist.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ filterAutogenModules pkg_descr0 =
428428
filterFunction bi = \mn ->
429429
mn /= pathsModule
430430
&& mn /= packageInfoModule
431-
&& not (mn `elem` autogenModules bi)
431+
&& notElem mn (autogenModules bi)
432432

433433
-- | Prepare a directory tree of source files for a snapshot version.
434434
-- It is expected that the appropriate snapshot version has already been set

cabal-install/src/Distribution/Client/CmdInstall.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ installCommand =
331331
}
332332
where
333333
-- install doesn't take installDirs flags, since it always installs into the store in a fixed way.
334-
notInstallDirOpt x = not $ optionName x `elem` installDirOptNames
334+
notInstallDirOpt x = notElem (optionName x) installDirOptNames
335335
installDirOptNames = map optionName installDirsOptions
336336

337337
-- | The @install@ command actually serves four different needs. It installs:

cabal-install/src/Distribution/Client/CmdUpdate.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ updateAction flags@NixStyleFlags{..} extraArgs globalFlags = do
179179
unless (null updateRepoRequests) $ do
180180
let remoteRepoNames = map repoName repos
181181
unknownRepos =
182-
[ r | (UpdateRequest r _) <- updateRepoRequests, not (r `elem` remoteRepoNames)
182+
[ r | (UpdateRequest r _) <- updateRepoRequests, notElem r remoteRepoNames
183183
]
184184
unless (null unknownRepos) $
185185
dieWithException verbosity $

cabal-install/src/Distribution/Client/Install.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -782,7 +782,7 @@ checkPrintPlan
782782
-- likely to be broken. We exclude packages that are already broken.
783783
let newBrokenPkgs =
784784
filter
785-
(\p -> not (Installed.installedUnitId p `elem` excluded))
785+
(\p -> notElem (Installed.installedUnitId p) excluded)
786786
(PackageIndex.reverseDependencyClosure installed reinstalledPkgs)
787787
let containsReinstalls = not (null reinstalledPkgs)
788788
let breaksPkgs = not (null newBrokenPkgs)

cabal-install/src/Distribution/Client/Types/AllowNewer.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ isRelaxDeps RelaxDepsAll = True
214214
-- | A smarter 'RelaxedDepsSome', @*:*@ is the same as @all@.
215215
mkRelaxDepSome :: [RelaxedDep] -> RelaxDeps
216216
mkRelaxDepSome xs
217-
| any (== RelaxedDep RelaxDepScopeAll RelaxDepModNone RelaxDepSubjectAll) xs =
217+
| elem (RelaxedDep RelaxDepScopeAll RelaxDepModNone RelaxDepSubjectAll) xs =
218218
RelaxDepsAll
219219
| otherwise =
220220
RelaxDepsSome xs

0 commit comments

Comments
 (0)