Skip to content

Commit

Permalink
Swift Format changes
Browse files Browse the repository at this point in the history
  • Loading branch information
adam-fowler committed Feb 17, 2024
1 parent 70a25eb commit c7b1867
Show file tree
Hide file tree
Showing 7 changed files with 149 additions and 149 deletions.
2 changes: 1 addition & 1 deletion Benchmarks/Benchmarks/Router/Benchmarks.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
//
//===----------------------------------------------------------------------===//

@testable import Hummingbird
import Benchmark
@testable import Hummingbird

let benchmarks = {
Benchmark.defaultConfiguration = .init(
Expand Down
4 changes: 2 additions & 2 deletions Benchmarks/Benchmarks/Router/RouterBenchmarks.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ extension Benchmark {
for _ in 0..<50 {
try await withThrowingTaskGroup(of: Void.self) { group in
let context = Context(
allocator: ByteBufferAllocator(),
allocator: ByteBufferAllocator(),
logger: Logger(label: "Benchmark")
)
let (inbound, source) = NIOAsyncChannelInboundStream<HTTPRequestPart>.makeTestingStream()
Expand Down Expand Up @@ -86,7 +86,7 @@ extension HTTPField.Name {
}

func routerBenchmarks() {
let buffer = ByteBufferAllocator().buffer(repeating: 0xff, count: 10000)
let buffer = ByteBufferAllocator().buffer(repeating: 0xFF, count: 10000)
Benchmark(
name: "Router:GET",
configuration: .init(warmupIterations: 10),
Expand Down
10 changes: 5 additions & 5 deletions Benchmarks/Benchmarks/Router/TrieRouterBenchmarks.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
//
//===----------------------------------------------------------------------===//

@testable import Hummingbird
import Benchmark
@testable import Hummingbird

func trieRouterBenchmarks() {
var trie: RouterPathTrie<String>!
Expand All @@ -25,9 +25,9 @@ func trieRouterBenchmarks() {
"/doesntExist",
]
benchmark.startMeasurement()

for _ in benchmark.scaledIterations {
blackHole(testValues.map { trie.getValueAndParameters($0)})
blackHole(testValues.map { trie.getValueAndParameters($0) })
}
} setup: {
let trieBuilder = RouterPathTrieBuilder<String>()
Expand All @@ -48,9 +48,9 @@ func trieRouterBenchmarks() {
"/test2/one/two",
]
benchmark.startMeasurement()

for _ in benchmark.scaledIterations {
blackHole(testValues.map { trie2.getValueAndParameters($0)})
blackHole(testValues.map { trie2.getValueAndParameters($0) })
}
} setup: {
let trieBuilder = RouterPathTrieBuilder<String>()
Expand Down
2 changes: 1 addition & 1 deletion Sources/Hummingbird/Middleware/TracingMiddleware.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public struct HBTracingMiddleware<Context: HBBaseRequestContext>: HBMiddlewarePr
/// - Parameters
/// - recordingHeaders: A list of HTTP header names to be recorded as span attributes. By default, no headers
/// are being recorded.
/// - parameters: A list of static parameters added to every span. These could be the "net.host.name",
/// - parameters: A list of static parameters added to every span. These could be the "net.host.name",
/// "net.host.port" or "http.scheme"
public init(recordingHeaders headerNamesToRecord: some Collection<HTTPField.Name> = [], attributes: SpanAttributes? = nil) {
self.headerNamesToRecord = Set(headerNamesToRecord.map(RecordingHeader.init))
Expand Down
8 changes: 4 additions & 4 deletions Sources/HummingbirdCore/Response/ResponseBody.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,22 +57,22 @@ public struct HBResponseBody: Sendable {
}
}

/// Create HBResponseBody that returns trailing headers from its closure once all the
/// body parts have been written
/// Create HBResponseBody that returns trailing headers from its closure once all the
/// body parts have been written
/// - Parameters:
/// - contentLength: Optional length of body
/// - write: closure provided with `writer` type that can be used to write to response body
/// trailing headers are returned from the closure after all the body parts have been
/// written
public static func withTrailingHeaders(
contentLength: Int? = nil,
contentLength: Int? = nil,
_ write: @Sendable @escaping (any HBResponseBodyWriter) async throws -> HTTPFields?
) -> Self {
self.init(contentLength: contentLength, write: write)
}

/// Initialise HBResponseBody with closure writing body contents
///
///
/// This version of init is private and only available via ``withTrailingHeaders`` because
/// if it is public the compiler gets confused when a complex closure is provided.
private init(contentLength: Int? = nil, write: @Sendable @escaping (any HBResponseBodyWriter) async throws -> HTTPFields?) {
Expand Down
2 changes: 1 addition & 1 deletion Sources/HummingbirdHTTP2/HTTP2Channel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public struct HTTP2UpgradeChannel: HTTPChannelHandler {
logger.error("Error handling inbound connection for HTTP2 handler: \(error)")
}
// have to run this to ensure http2 channel outbound writer is closed
try await http2.executeThenClose { _,_ in}
try await http2.executeThenClose { _, _ in }
}
} catch {
logger.error("Error getting HTTP2 upgrade negotiated value: \(error)")
Expand Down
Loading

0 comments on commit c7b1867

Please sign in to comment.