mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[stdlib] Using map and guard let for nil handling
This commit is contained in:
@@ -177,9 +177,8 @@ public struct EnumerateGenerator<
|
||||
///
|
||||
/// - Requires: No preceding call to `self.next()` has returned `nil`.
|
||||
public mutating func next() -> Element? {
|
||||
let b = base.next()
|
||||
if b == nil { return .None }
|
||||
return .Some((index: count++, element: b!))
|
||||
guard let b = base.next() else { return .None }
|
||||
return .Some((index: count++, element: b))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user