File tree Expand file tree Collapse file tree 2 files changed +3
-5
lines changed
Expand file tree Collapse file tree 2 files changed +3
-5
lines changed Original file line number Diff line number Diff line change @@ -177,9 +177,8 @@ public struct EnumerateGenerator<
177177 ///
178178 /// - Requires: No preceding call to `self.next()` has returned `nil`.
179179 public mutating func next( ) -> Element ? {
180- let b = base. next ( )
181- if b == nil { return . None }
182- return . Some( ( index: count++ , element: b!) )
180+ guard let b = base. next ( ) else { return . None }
181+ return . Some( ( index: count++ , element: b) )
183182 }
184183}
185184
Original file line number Diff line number Diff line change @@ -765,8 +765,7 @@ public struct PermutationGenerator<
765765 ///
766766 /// - Requires: No preceding call to `self.next()` has returned `nil`.
767767 public mutating func next( ) -> Element ? {
768- let result = indices. next ( )
769- return result != nil ? seq [ result!] : . None
768+ return indices. next ( ) . map { seq [ $0] }
770769 }
771770
772771 /// Construct a *generator* over a permutation of `elements` given
You can’t perform that action at this time.
0 commit comments