diff --git a/Sources/NIOEmbedded/AsyncTestingChannel.swift b/Sources/NIOEmbedded/AsyncTestingChannel.swift index 0b3ab4b3f4..d3a4834f7e 100644 --- a/Sources/NIOEmbedded/AsyncTestingChannel.swift +++ b/Sources/NIOEmbedded/AsyncTestingChannel.swift @@ -288,8 +288,10 @@ public final class NIOAsyncTestingChannel: Channel { /// - handler: The `ChannelHandler` to add to the `ChannelPipeline` before register. /// - loop: The ``NIOAsyncTestingEventLoop`` to use. @preconcurrency - public convenience init(handler: ChannelHandler & Sendable, loop: NIOAsyncTestingEventLoop = NIOAsyncTestingEventLoop()) async - { + public convenience init( + handler: ChannelHandler & Sendable, + loop: NIOAsyncTestingEventLoop = NIOAsyncTestingEventLoop() + ) async { await self.init(handlers: [handler], loop: loop) } @@ -680,4 +682,4 @@ extension NIOAsyncTestingChannel.BufferState: @unchecked Sendable {} // Synchronous options are never Sendable. @available(*, unavailable) -extension NIOAsyncTestingChannel.SynchronousOptions: Sendable { } +extension NIOAsyncTestingChannel.SynchronousOptions: Sendable {} diff --git a/Sources/NIOEmbedded/AsyncTestingEventLoop.swift b/Sources/NIOEmbedded/AsyncTestingEventLoop.swift index c39090047c..3321a6a601 100644 --- a/Sources/NIOEmbedded/AsyncTestingEventLoop.swift +++ b/Sources/NIOEmbedded/AsyncTestingEventLoop.swift @@ -159,7 +159,10 @@ public final class NIOAsyncTestingEventLoop: EventLoop, @unchecked Sendable { /// - see: `EventLoop.scheduleTask(deadline:_:)` @discardableResult @preconcurrency - public func scheduleTask(deadline: NIODeadline, _ task: @escaping @Sendable () throws -> T) -> Scheduled { + public func scheduleTask( + deadline: NIODeadline, + _ task: @escaping @Sendable () throws -> T + ) -> Scheduled { let promise: EventLoopPromise = self.makePromise() let taskID = self.scheduledTaskCounter.loadThenWrappingIncrement(ordering: .relaxed) diff --git a/Sources/NIOEmbedded/Embedded.swift b/Sources/NIOEmbedded/Embedded.swift index e7ebf44263..865a97c88a 100644 --- a/Sources/NIOEmbedded/Embedded.swift +++ b/Sources/NIOEmbedded/Embedded.swift @@ -383,7 +383,7 @@ public final class EmbeddedEventLoop: EventLoop, CustomStringConvertible { // EmbeddedEventLoop is extremely _not_ Sendable. However, the EventLoop protocol // requires it to be. We are doing some runtime enforcement of correct use, but // ultimately we can't have the compiler validating this usage. -extension EmbeddedEventLoop: @unchecked Sendable { } +extension EmbeddedEventLoop: @unchecked Sendable {} @usableFromInline class EmbeddedChannelCore: ChannelCore { @@ -608,7 +608,7 @@ class EmbeddedChannelCore: ChannelCore { // ChannelCores are basically never Sendable. @available(*, unavailable) -extension EmbeddedChannelCore: Sendable { } +extension EmbeddedChannelCore: Sendable {} /// `EmbeddedChannel` is a `Channel` implementation that does neither any /// actual IO nor has a proper eventing mechanism. The prime use-case for @@ -1116,7 +1116,7 @@ extension EmbeddedChannel { // EmbeddedChannel is extremely _not_ Sendable. However, the Channel protocol // requires it to be. We are doing some runtime enforcement of correct use, but // ultimately we can't have the compiler validating this usage. -extension EmbeddedChannel: @unchecked Sendable { } +extension EmbeddedChannel: @unchecked Sendable {} @available(*, unavailable) extension EmbeddedChannel.LeftOverState: @unchecked Sendable {} diff --git a/Tests/NIOEmbeddedTests/AsyncTestingEventLoopTests.swift b/Tests/NIOEmbeddedTests/AsyncTestingEventLoopTests.swift index d5eb57266f..86920495f0 100644 --- a/Tests/NIOEmbeddedTests/AsyncTestingEventLoopTests.swift +++ b/Tests/NIOEmbeddedTests/AsyncTestingEventLoopTests.swift @@ -519,8 +519,12 @@ final class NIOAsyncTestingEventLoopTests: XCTestCase { let eventLoop = NIOAsyncTestingEventLoop() let tasksRun = ManagedAtomic(0) - let a = eventLoop.scheduleTask(in: .seconds(1)) { tasksRun.wrappingIncrement(ordering: .sequentiallyConsistent) } - let b = eventLoop.scheduleTask(in: .seconds(2)) { tasksRun.wrappingIncrement(ordering: .sequentiallyConsistent) } + let a = eventLoop.scheduleTask(in: .seconds(1)) { + tasksRun.wrappingIncrement(ordering: .sequentiallyConsistent) + } + let b = eventLoop.scheduleTask(in: .seconds(2)) { + tasksRun.wrappingIncrement(ordering: .sequentiallyConsistent) + } XCTAssertEqual(tasksRun.load(ordering: .sequentiallyConsistent), 0) diff --git a/Tests/NIOEmbeddedTests/EmbeddedChannelTest.swift b/Tests/NIOEmbeddedTests/EmbeddedChannelTest.swift index a13386e900..3b48ed3b3f 100644 --- a/Tests/NIOEmbeddedTests/EmbeddedChannelTest.swift +++ b/Tests/NIOEmbeddedTests/EmbeddedChannelTest.swift @@ -117,13 +117,19 @@ class EmbeddedChannelTest: XCTestCase { let channel = EmbeddedChannel( handlers: [Handler(identifier: "0"), Handler(identifier: "1"), Handler(identifier: "2")] ) - XCTAssertNoThrow(XCTAssertEqual(try channel.pipeline.handler(type: Handler.self).map { $0.identifier }.wait(), "0")) + XCTAssertNoThrow( + XCTAssertEqual(try channel.pipeline.handler(type: Handler.self).map { $0.identifier }.wait(), "0") + ) XCTAssertNoThrow(try channel.pipeline.removeHandler(name: "handler0").wait()) - XCTAssertNoThrow(XCTAssertEqual(try channel.pipeline.handler(type: Handler.self).map { $0.identifier }.wait(), "1")) + XCTAssertNoThrow( + XCTAssertEqual(try channel.pipeline.handler(type: Handler.self).map { $0.identifier }.wait(), "1") + ) XCTAssertNoThrow(try channel.pipeline.removeHandler(name: "handler1").wait()) - XCTAssertNoThrow(XCTAssertEqual(try channel.pipeline.handler(type: Handler.self).map { $0.identifier }.wait(), "2")) + XCTAssertNoThrow( + XCTAssertEqual(try channel.pipeline.handler(type: Handler.self).map { $0.identifier }.wait(), "2") + ) XCTAssertNoThrow(try channel.pipeline.removeHandler(name: "handler2").wait()) } diff --git a/Tests/NIOEmbeddedTests/EmbeddedEventLoopTest.swift b/Tests/NIOEmbeddedTests/EmbeddedEventLoopTest.swift index 5e3ce67362..989bef581f 100644 --- a/Tests/NIOEmbeddedTests/EmbeddedEventLoopTest.swift +++ b/Tests/NIOEmbeddedTests/EmbeddedEventLoopTest.swift @@ -533,4 +533,4 @@ public final class EmbeddedEventLoopTest: XCTestCase { } @available(*, unavailable) -extension EmbeddedEventLoopTest: Sendable { } +extension EmbeddedEventLoopTest: Sendable {}