mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[Dispatch][gardening] Use Optional.map over flatMap where appropriate
The initializers used here are not optional ones, so there is no need to use `flatMap`.
This commit is contained in:
@@ -344,8 +344,8 @@ public extension DispatchQueue {
|
||||
|
||||
public func setSpecific<T>(key: DispatchSpecificKey<T>, value: T?) {
|
||||
let k = Unmanaged.passUnretained(key).toOpaque()
|
||||
let v = value.flatMap { _DispatchSpecificValue(value: $0) }
|
||||
let p = v.flatMap { Unmanaged.passRetained($0).toOpaque() }
|
||||
let v = value.map { _DispatchSpecificValue(value: $0) }
|
||||
let p = v.map { Unmanaged.passRetained($0).toOpaque() }
|
||||
__dispatch_queue_set_specific(self, k, p, _destructDispatchSpecificValue)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user