Skip to content

Commit b76f4b4

Browse files
committed
Re-format code
1 parent 9cdcd2d commit b76f4b4

File tree

159 files changed

+2119
-1487
lines changed

Some content is hidden

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

159 files changed

+2119
-1487
lines changed

Sources/Examples/Echo/Implementation/HPACKHeaders+Prettify.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
import NIOHPACK
1717

1818
func prettify(_ headers: HPACKHeaders) -> String {
19-
return "[" + headers.map { name, value, _ in
20-
"'\(name)': '\(value)'"
21-
}.joined(separator: ", ") + "]"
19+
return "["
20+
+ headers.map { name, value, _ in
21+
"'\(name)': '\(value)'"
22+
}.joined(separator: ", ") + "]"
2223
}

Sources/Examples/Echo/Implementation/Interceptors.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,8 @@ public final class ExampleClientInterceptorFactory: Echo_EchoClientInterceptorFa
107107

108108
// Returns an array of interceptors to use for the 'Collect' RPC.
109109
public func makeCollectInterceptors()
110-
-> [ClientInterceptor<Echo_EchoRequest, Echo_EchoResponse>] {
110+
-> [ClientInterceptor<Echo_EchoRequest, Echo_EchoResponse>]
111+
{
111112
return [LoggingEchoClientInterceptor()]
112113
}
113114

Sources/Examples/Echo/Runtime/Echo.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import GRPC
2020
import GRPCSampleData
2121
import NIOCore
2222
import NIOPosix
23+
2324
#if canImport(NIOSSL)
2425
import NIOSSL
2526
#endif
@@ -136,7 +137,7 @@ func startEchoServer(group: EventLoopGroup, port: Int, useTLS: Bool) async throw
136137
print("starting secure server")
137138
#else
138139
fatalError("'useTLS: true' passed to \(#function) but NIOSSL is not available")
139-
#endif // canImport(NIOSSL)
140+
#endif // canImport(NIOSSL)
140141
} else {
141142
print("starting insecure server")
142143
builder = Server.insecure(group: group)
@@ -180,7 +181,7 @@ func makeClient(
180181
.withTLS(trustRoots: .certificates([caCert.certificate]))
181182
#else
182183
fatalError("'useTLS: true' passed to \(#function) but NIOSSL is not available")
183-
#endif // canImport(NIOSSL)
184+
#endif // canImport(NIOSSL)
184185
} else {
185186
builder = ClientConnection.insecure(group: group)
186187
}

Sources/Examples/PacketCapture/PacketCapture.swift

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,11 @@ struct PCAP: AsyncParsableCommand {
5656
// used TLS we would likely want to place the handler in a different position in the
5757
// pipeline so that the captured packets in the trace would not be encrypted.
5858
let writePCAPHandler = NIOWritePCAPHandler(mode: .client, fileSink: fileSink.write(buffer:))
59-
return channel.eventLoop.makeCompletedFuture(Result {
60-
try channel.pipeline.syncOperations.addHandler(writePCAPHandler, position: .first)
61-
})
59+
return channel.eventLoop.makeCompletedFuture(
60+
Result {
61+
try channel.pipeline.syncOperations.addHandler(writePCAPHandler, position: .first)
62+
}
63+
)
6264
}
6365
}
6466

Sources/Examples/RouteGuide/Client/RouteGuideClient.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ import RouteGuideModel
2323
/// Loads the features from `route_guide_db.json`, assumed to be in the directory above this file.
2424
func loadFeatures() throws -> [Routeguide_Feature] {
2525
let url = URL(fileURLWithPath: #filePath)
26-
.deletingLastPathComponent() // main.swift
27-
.deletingLastPathComponent() // Client/
26+
.deletingLastPathComponent() // main.swift
27+
.deletingLastPathComponent() // Client/
2828
.appendingPathComponent("route_guide_db.json")
2929

3030
let data = try Data(contentsOf: url)
@@ -146,8 +146,8 @@ extension RouteGuideExample {
146146
let summary = try await recordRoute.response
147147

148148
print(
149-
"Finished trip with \(summary.pointCount) points. Passed \(summary.featureCount) features. " +
150-
"Travelled \(summary.distance) meters. It took \(summary.elapsedTime) seconds."
149+
"Finished trip with \(summary.pointCount) points. Passed \(summary.featureCount) features. "
150+
+ "Travelled \(summary.distance) meters. It took \(summary.elapsedTime) seconds."
151151
)
152152
} catch {
153153
print("RecordRoute Failed: \(error)")

Sources/Examples/RouteGuide/Server/RouteGuideProvider.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,8 @@ extension Routeguide_Point {
148148
let deltaLat = lat2 - lat1
149149
let deltaLon = lon2 - lon1
150150

151-
let a = sin(deltaLat / 2) * sin(deltaLat / 2)
151+
let a =
152+
sin(deltaLat / 2) * sin(deltaLat / 2)
152153
+ cos(lat1) * cos(lat2) * sin(deltaLon / 2) * sin(deltaLon / 2)
153154
let c = 2 * atan2(sqrt(a), sqrt(1 - a))
154155

Sources/Examples/RouteGuide/Server/RouteGuideServer.swift

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,19 @@
1414
* limitations under the License.
1515
*/
1616
import ArgumentParser
17-
import struct Foundation.Data
18-
import struct Foundation.URL
1917
import GRPC
2018
import NIOCore
2119
import NIOPosix
2220
import RouteGuideModel
2321

22+
import struct Foundation.Data
23+
import struct Foundation.URL
24+
2425
/// Loads the features from `route_guide_db.json`, assumed to be in the directory above this file.
2526
func loadFeatures() throws -> [Routeguide_Feature] {
2627
let url = URL(fileURLWithPath: #filePath)
27-
.deletingLastPathComponent() // main.swift
28-
.deletingLastPathComponent() // Server/
28+
.deletingLastPathComponent() // main.swift
29+
.deletingLastPathComponent() // Server/
2930
.appendingPathComponent("route_guide_db.json")
3031

3132
let data = try Data(contentsOf: url)

Sources/GRPC/AsyncAwaitSupport/Call+AsyncRequestStreamWriter.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,13 @@ extension Call where Request: Sendable, Response: Sendable {
2222
GRPCAsyncWriterSinkDelegate<(Request, Compression)>
2323
>
2424
internal func makeRequestStreamWriter()
25-
-> (GRPCAsyncRequestStreamWriter<Request>, AsyncWriter.Sink) {
25+
-> (GRPCAsyncRequestStreamWriter<Request>, AsyncWriter.Sink)
26+
{
2627
let delegate = GRPCAsyncWriterSinkDelegate<(Request, Compression)>(
2728
didYield: { requests in
2829
for (request, compression) in requests {
29-
let compress = compression
30+
let compress =
31+
compression
3032
.isEnabled(callDefault: self.options.messageEncoding.enabledForRequests)
3133

3234
// TODO: be smarter about inserting flushes.

Sources/GRPC/AsyncAwaitSupport/GRPCAsyncBidirectionalStreamingCall.swift

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,13 @@ import NIOHPACK
2121
public struct GRPCAsyncBidirectionalStreamingCall<Request: Sendable, Response: Sendable>: Sendable {
2222
private let call: Call<Request, Response>
2323
private let responseParts: StreamingResponseParts<Response>
24-
private let responseSource: NIOThrowingAsyncSequenceProducer<
25-
Response,
26-
Error,
27-
NIOAsyncSequenceProducerBackPressureStrategies.HighLowWatermark,
28-
GRPCAsyncSequenceProducerDelegate
29-
>.Source
24+
private let responseSource:
25+
NIOThrowingAsyncSequenceProducer<
26+
Response,
27+
Error,
28+
NIOAsyncSequenceProducerBackPressureStrategies.HighLowWatermark,
29+
GRPCAsyncSequenceProducerDelegate
30+
>.Source
3031
private let requestSink: AsyncSink<(Request, Compression)>
3132

3233
/// A request stream writer for sending messages to the server.

Sources/GRPC/AsyncAwaitSupport/GRPCAsyncServerHandler.swift

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -232,19 +232,23 @@ internal final class AsyncServerHandler<
232232
internal private(set) var handlerStateMachine: ServerHandlerStateMachine
233233
/// A bag of components used by the user handler.
234234
@usableFromInline
235-
internal private(set) var handlerComponents: Optional<ServerHandlerComponents<
236-
Request,
237-
Response,
238-
GRPCAsyncWriterSinkDelegate<(Response, Compression)>
239-
>>
235+
internal private(set) var handlerComponents:
236+
Optional<
237+
ServerHandlerComponents<
238+
Request,
239+
Response,
240+
GRPCAsyncWriterSinkDelegate<(Response, Compression)>
241+
>
242+
>
240243

241244
/// The user provided function to execute.
242245
@usableFromInline
243-
internal let userHandler: @Sendable (
244-
GRPCAsyncRequestStream<Request>,
245-
GRPCAsyncResponseStreamWriter<Response>,
246-
GRPCAsyncServerCallContext
247-
) async throws -> Void
246+
internal let userHandler:
247+
@Sendable (
248+
GRPCAsyncRequestStream<Request>,
249+
GRPCAsyncResponseStreamWriter<Response>,
250+
GRPCAsyncServerCallContext
251+
) async throws -> Void
248252

249253
@usableFromInline
250254
internal typealias AsyncSequenceProducer = NIOThrowingAsyncSequenceProducer<
@@ -415,7 +419,7 @@ internal final class AsyncServerHandler<
415419
internal func receiveInterceptedMetadata(_ headers: HPACKHeaders) {
416420
switch self.interceptorStateMachine.interceptedRequestMetadata() {
417421
case .forward:
418-
() // continue
422+
() // continue
419423
case .cancel:
420424
return self.cancel(error: nil)
421425
case .drop:

0 commit comments

Comments
 (0)