From 44b0e4f2dd2eae6d494d7e655c38b9e430ea9849 Mon Sep 17 00:00:00 2001 From: Chris Eidhof Date: Fri, 4 Dec 2015 09:15:29 -0800 Subject: [PATCH] Use Optional's built-in map --- stdlib/public/core/Map.swift | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/stdlib/public/core/Map.swift b/stdlib/public/core/Map.swift index db885411e7f1a..0ab8e660ca80c 100644 --- a/stdlib/public/core/Map.swift +++ b/stdlib/public/core/Map.swift @@ -26,11 +26,7 @@ public struct LazyMapGenerator< /// since the copy was made, and no preceding call to `self.next()` /// has returned `nil`. public mutating func next() -> Element? { - let x = _base.next() - if x != nil { - return _transform(x!) - } - return nil + return _base.next().map(_transform) } public var base: Base { return _base }