Skip to content

Commit b31ef40

Browse files
authored
Refactor withCheckedThrowingContinuation calls to get rid of warnings (#7981)
1 parent c79e7b5 commit b31ef40

File tree

5 files changed

+16
-16
lines changed

5 files changed

+16
-16
lines changed

Sources/Basics/HTTPClient/LegacyHTTPClient.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -314,8 +314,8 @@ extension LegacyHTTPClient {
314314
options: Request.Options = .init(),
315315
observabilityScope: ObservabilityScope? = .none
316316
) async throws -> Response {
317-
try await withCheckedThrowingContinuation {
318-
self.head(url, headers: headers, options: options, completion: $0.resume(with:))
317+
try await withCheckedThrowingContinuation { continuation in
318+
self.head(url, headers: headers, options: options, completion: { continuation.resume(with: $0) })
319319
}
320320
}
321321
@available(*, noasync, message: "Use the async alternative")
@@ -339,8 +339,8 @@ extension LegacyHTTPClient {
339339
options: Request.Options = .init(),
340340
observabilityScope: ObservabilityScope? = .none
341341
) async throws -> Response {
342-
try await withCheckedThrowingContinuation {
343-
self.get(url, headers: headers, options: options, completion: $0.resume(with:))
342+
try await withCheckedThrowingContinuation { continuation in
343+
self.get(url, headers: headers, options: options, completion: { continuation.resume(with: $0) })
344344
}
345345
}
346346
@available(*, noasync, message: "Use the async alternative")

Sources/PackageRegistry/RegistryDownloadsManager.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,14 @@ public class RegistryDownloadsManager: Cancellable {
5252
delegateQueue: DispatchQueue,
5353
callbackQueue: DispatchQueue
5454
) async throws -> AbsolutePath {
55-
try await withCheckedThrowingContinuation {
55+
try await withCheckedThrowingContinuation { continuation in
5656
self.lookup(
5757
package: package,
5858
version: version,
5959
observabilityScope: observabilityScope,
6060
delegateQueue: delegateQueue,
6161
callbackQueue: callbackQueue,
62-
completion: $0.resume(with:)
62+
completion: { continuation.resume(with: $0) }
6363
)
6464
}
6565
}

Sources/PackageRegistry/SignatureValidation.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ struct SignatureValidation {
6464
observabilityScope: ObservabilityScope,
6565
callbackQueue: DispatchQueue
6666
) async throws -> SigningEntity? {
67-
try await withCheckedThrowingContinuation {
67+
try await withCheckedThrowingContinuation { continuation in
6868
self.validate(
6969
registry: registry,
7070
package: package,
@@ -75,7 +75,7 @@ struct SignatureValidation {
7575
fileSystem: fileSystem,
7676
observabilityScope: observabilityScope,
7777
callbackQueue: callbackQueue,
78-
completion: $0.resume(with:)
78+
completion: { continuation.resume(with: $0) }
7979
)
8080
}
8181
}
@@ -326,7 +326,7 @@ struct SignatureValidation {
326326
observabilityScope: ObservabilityScope,
327327
callbackQueue: DispatchQueue
328328
) async throws -> SigningEntity? {
329-
try await withCheckedThrowingContinuation {
329+
try await withCheckedThrowingContinuation { continuation in
330330
self.validate(
331331
registry: registry,
332332
package: package,
@@ -338,7 +338,7 @@ struct SignatureValidation {
338338
fileSystem:fileSystem,
339339
observabilityScope: observabilityScope,
340340
callbackQueue: callbackQueue,
341-
completion: $0.resume(with:)
341+
completion: { continuation.resume(with: $0) }
342342
)
343343
}
344344
}
@@ -582,13 +582,13 @@ struct SignatureValidation {
582582
configuration: RegistryConfiguration.Security.Signing,
583583
fileSystem: FileSystem
584584
) async throws -> SigningEntity? {
585-
try await withCheckedThrowingContinuation {
585+
try await withCheckedThrowingContinuation { continuation in
586586
SignatureValidation.extractSigningEntity(
587587
signature: signature,
588588
signatureFormat: signatureFormat,
589589
configuration: configuration,
590590
fileSystem: fileSystem,
591-
completion: $0.resume(with:)
591+
completion: { continuation.resume(with: $0) }
592592
)
593593
}
594594
}

Sources/PackageRegistry/SigningEntityTOFU.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,15 @@ struct PackageSigningEntityTOFU {
3939
observabilityScope: ObservabilityScope,
4040
callbackQueue: DispatchQueue
4141
) async throws {
42-
try await withCheckedThrowingContinuation {
42+
try await withCheckedThrowingContinuation { continuation in
4343
self.validate(
4444
registry: registry,
4545
package: package,
4646
version: version,
4747
signingEntity: signingEntity,
4848
observabilityScope: observabilityScope,
4949
callbackQueue: callbackQueue,
50-
completion: $0.resume(with:)
50+
completion: { continuation.resume(with: $0) }
5151
)
5252
}
5353
}

Sources/SourceControl/RepositoryManager.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,15 +99,15 @@ public class RepositoryManager: Cancellable {
9999
delegateQueue: DispatchQueue,
100100
callbackQueue: DispatchQueue
101101
) async throws -> RepositoryHandle {
102-
try await withCheckedThrowingContinuation {
102+
try await withCheckedThrowingContinuation { continuation in
103103
self.lookup(
104104
package: package,
105105
repository: repository,
106106
updateStrategy: updateStrategy,
107107
observabilityScope: observabilityScope,
108108
delegateQueue: delegateQueue,
109109
callbackQueue: callbackQueue,
110-
completion: $0.resume(with:)
110+
completion: { continuation.resume(with: $0) }
111111
)
112112
}
113113
}

0 commit comments

Comments
 (0)