mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[stdlib] Reorder increment and element creation to not need (#5062)
This commit is contained in:
committed by
Maxim Moiseev
parent
32634b1bdd
commit
3d7f8cc1a0
@@ -106,8 +106,9 @@ public struct EnumeratedIterator<
|
||||
/// Once `nil` has been returned, all subsequent calls return `nil`.
|
||||
public mutating func next() -> Element? {
|
||||
guard let b = _base.next() else { return nil }
|
||||
defer { _count += 1 }
|
||||
return (offset: _count, element: b)
|
||||
let result = (offset: _count, element: b)
|
||||
_count += 1
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user