Skip to content

Commit aabebd2

Browse files
authored
Merge pull request #2354 from aciidb0mb3r/warnings
Fix warnings
2 parents ad4b7ef + 8b5d9c1 commit aabebd2

File tree

4 files changed

+17
-13
lines changed

4 files changed

+17
-13
lines changed

Sources/PackageGraph/Pubgrub.swift

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -213,8 +213,7 @@ public struct Incompatibility: Equatable, Hashable {
213213
// Remove the root package from generated incompatibilities, since it will
214214
// always be selected.
215215
var terms = terms
216-
if terms.count > 1,
217-
case .conflict(conflict: _, other: _) = cause,
216+
if terms.count > 1, cause.isConflict,
218217
terms.contains(where: { $0.isPositive && $0.package == root }) {
219218
terms = OrderedSet(terms.filter { !$0.isPositive || $0.package != root })
220219
}
@@ -262,6 +261,11 @@ extension Incompatibility {
262261
/// └────────────┘
263262
/// ```
264263
indirect enum Cause: Equatable, Hashable {
264+
struct ConflictCause: Hashable {
265+
let conflict: Incompatibility
266+
let other: Incompatibility
267+
}
268+
265269
/// The root incompatibility.
266270
case root
267271

@@ -271,7 +275,7 @@ extension Incompatibility {
271275

272276
/// The incompatibility was derived from two others during conflict
273277
/// resolution.
274-
case conflict(conflict: Incompatibility, other: Incompatibility)
278+
case conflict(cause: ConflictCause)
275279

276280
/// There exists no version to fulfill the specified requirement.
277281
case noAvailableVersion
@@ -1104,7 +1108,7 @@ public final class PubgrubDependencyResolver {
11041108
incompatibility = Incompatibility(
11051109
OrderedSet(newTerms),
11061110
root: root!,
1107-
cause: .conflict(conflict: incompatibility, other: priorCause))
1111+
cause: .conflict(cause: .init(conflict: incompatibility, other: priorCause)))
11081112
createdIncompatibility = true
11091113

11101114
log("CR: \(mostRecentTerm?.description ?? "") is\(difference != nil ? " partially" : "") satisfied by \(_mostRecentSatisfier)")
@@ -1193,9 +1197,9 @@ private final class DiagnosticReportBuilder {
11931197
/// Populate `derivations`.
11941198
func countDerivations(_ i: Incompatibility) {
11951199
derivations[i, default: 0] += 1
1196-
if case .conflict(let lhs, let rhs) = i.cause {
1197-
countDerivations(lhs)
1198-
countDerivations(rhs)
1200+
if case .conflict(let cause) = i.cause {
1201+
countDerivations(cause.conflict)
1202+
countDerivations(cause.other)
11991203
}
12001204
}
12011205

Sources/PackageLoading/ModuleMapGenerator.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ public struct ModuleMapGenerator {
183183
extension ModuleMapGenerator.ModuleMapError: CustomStringConvertible {
184184
public var description: String {
185185
switch self {
186-
case .unsupportedIncludeLayoutForModule(let (name, problem)):
186+
case .unsupportedIncludeLayoutForModule(let name, let problem):
187187
return "target '\(name)' failed modulemap generation; \(problem)"
188188
}
189189
}
@@ -192,15 +192,15 @@ extension ModuleMapGenerator.ModuleMapError: CustomStringConvertible {
192192
extension ModuleMapGenerator.ModuleMapError.UnsupportedIncludeLayoutType: CustomStringConvertible {
193193
public var description: String {
194194
switch self {
195-
case .umbrellaHeaderWithAdditionalNonEmptyDirectories(let (umbrella, dirs)):
195+
case .umbrellaHeaderWithAdditionalNonEmptyDirectories(let umbrella, let dirs):
196196
return "umbrella header defined at '\(umbrella)', but directories exist: " +
197197
dirs.map({ $0.description }).sorted().joined(separator: ", ") +
198198
"; consider removing them"
199-
case .umbrellaHeaderWithAdditionalDirectoriesInIncludeDirectory(let (umbrella, dirs)):
199+
case .umbrellaHeaderWithAdditionalDirectoriesInIncludeDirectory(let umbrella, let dirs):
200200
return "umbrella header defined at '\(umbrella)', but more than one directories exist: " +
201201
dirs.map({ $0.description }).sorted().joined(separator: ", ") +
202202
"; consider reducing them to one"
203-
case .umbrellaHeaderWithAdditionalFilesInIncludeDirectory(let (umbrella, files)):
203+
case .umbrellaHeaderWithAdditionalFilesInIncludeDirectory(let umbrella, let files):
204204
return "umbrella header defined at '\(umbrella)', but files exist:" +
205205
files.map({ $0.description }).sorted().joined(separator: ", ") +
206206
"; consider removing them"

Sources/TSCUtility/PkgConfig.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ struct PkgConfigParser {
210210
variables["pcfiledir"] = pcFile.parentDirectory.pathString
211211

212212
// Add pc_sysrootdir variable. This is the path of the sysroot directory for pc files.
213-
variables["pc_sysrootdir"] = Process.env["PKG_CONFIG_SYSROOT_DIR"] ?? "/"
213+
variables["pc_sysrootdir"] = ProcessEnv.vars["PKG_CONFIG_SYSROOT_DIR"] ?? "/"
214214

215215
let fileContents = try fileSystem.readFileContents(pcFile)
216216
// FIXME: Should we error out instead if content is not UTF8 representable?

Tests/PackageLoadingTests/PD5LoadingTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class PackageDescription5LoadingTests: XCTestCase {
4646
) {
4747
do {
4848
try loadManifestThrowing(contents, line: line, body: body)
49-
} catch ManifestParseError.invalidManifestFormat(let error) {
49+
} catch ManifestParseError.invalidManifestFormat(let error, _) {
5050
print(error)
5151
XCTFail(file: #file, line: line)
5252
} catch {

0 commit comments

Comments
 (0)