Skip to content

Commit 0930709

Browse files
committed
Don't create a longer lifetime for the value then necessary.
NFC
1 parent 1f559c7 commit 0930709

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

stdlib/public/core/Unmanaged.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,7 @@ public struct Unmanaged<Instance : AnyObject> {
178178
public func _withUnsafeGuaranteedRef<Result>(
179179
_ closure: @noescape (Instance) throws -> Result
180180
) rethrows -> Result {
181-
let instance = _value
182-
let (guaranteedInstance, token) = Builtin.unsafeGuaranteed(instance)
181+
let (guaranteedInstance, token) = Builtin.unsafeGuaranteed(_value)
183182
let result = try closure(guaranteedInstance)
184183
Builtin.unsafeGuaranteedEnd(token)
185184
return result

0 commit comments

Comments
 (0)