Skip to content

Commit f1688e3

Browse files
committed
Code review
1 parent 37e5c18 commit f1688e3

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Sources/NIOCore/NIOLoopBound.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -189,11 +189,11 @@ public final class NIOLoopBoundBox<Value>: @unchecked Sendable {
189189
/// - Returns: The value returned by the `handler` closure.
190190
/// - Note: This method is particularly useful when you need to perform read and write operations
191191
/// on the value because it reduces the on EventLoop checks.
192-
public func withValue<T, E: Error>(_ handler: (inout Value) throws(E) -> T) throws(E) -> T {
192+
public func withValue<Success, Failure: Error>(
193+
_ handler: (inout Value) throws(Failure) -> Success
194+
) throws(Failure) -> Success {
193195
self.eventLoop.preconditionInEventLoop()
194-
var value = self._value
195-
defer { self._value = value }
196-
return try handler(&value)
196+
return try handler(&self._value)
197197
}
198198
#endif
199199
}

0 commit comments

Comments
 (0)