Skip to content

Commit 71fc550

Browse files
authored
withLock should be marked as having a discardable result (#6615)
I noticed this through warnings, but I think this also generally makes sense since there isn't a requirement to consume the result here.
1 parent f2bf7d5 commit 71fc550

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Sources/Basics/Concurrency/NSLock+Extensions.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import class Foundation.NSLock
1414

1515
extension NSLock {
1616
/// Execute the given block while holding the lock.
17-
public func withLock<T>(_ body: () throws -> T) rethrows -> T {
17+
@discardableResult public func withLock<T>(_ body: () throws -> T) rethrows -> T {
1818
lock()
1919
defer { unlock() }
2020
return try body()

0 commit comments

Comments
 (0)