Skip to content

Commit d9720b5

Browse files
committed
Remove redundant checks
1 parent 762ecad commit d9720b5

File tree

1 file changed

+2
-13
lines changed

1 file changed

+2
-13
lines changed

src/Distribution/Server/Packages/Render.hs

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,7 @@ doPackageRender users info = PackageRender
159159
in (libName lib, ModSigIndex { modIndex = mod_ix, sigIndex = sig_ix })
160160
where
161161
-- Only show main library or internal libraries with public visibility
162-
isPublicLibrary lib = libName lib == LMainLibName
163-
|| libVisibility lib == LibraryVisibilityPublic
162+
isPublicLibrary lib = libVisibility lib == LibraryVisibilityPublic
164163

165164
moduleHasDocs :: Maybe TarIndex -> ModuleName -> Bool
166165
moduleHasDocs Nothing = const False
@@ -194,18 +193,8 @@ doPackageRender users info = PackageRender
194193
renderComponentName name@(CNotLibName _) = componentNameRaw name
195194

196195
allCondLibs :: GenericPackageDescription -> [(LibraryName, CondTree ConfVar [Dependency] Library)]
197-
allCondLibs desc = filter (isPublicCondLib . snd) $
198-
maybeToList ((LMainLibName,) <$> condLibrary desc)
196+
allCondLibs desc = maybeToList ((LMainLibName,) <$> condLibrary desc)
199197
++ (first LSubLibName <$> condSubLibraries desc)
200-
where
201-
-- Check if a conditional library tree contains a public library
202-
-- We need to check all branches since visibility can be conditional
203-
isPublicCondLib :: CondTree ConfVar [Dependency] Library -> Bool
204-
isPublicCondLib (CondNode lib _ branches) =
205-
let rootIsPublic = libName lib == LMainLibName || libVisibility lib == LibraryVisibilityPublic
206-
branchIsPublic (CondBranch _ thenTree elseTree) =
207-
isPublicCondLib thenTree || maybe False isPublicCondLib elseTree
208-
in rootIsPublic || any branchIsPublic branches
209198

210199
type DependencyTree = CondTree ConfVar [Dependency] IsBuildable
211200

0 commit comments

Comments
 (0)