File tree 2 files changed +3
-5
lines changed
2 files changed +3
-5
lines changed Original file line number Diff line number Diff line change @@ -177,9 +177,8 @@ public struct EnumerateGenerator<
177
177
///
178
178
/// - Requires: No preceding call to `self.next()` has returned `nil`.
179
179
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) )
183
182
}
184
183
}
185
184
Original file line number Diff line number Diff line change @@ -765,8 +765,7 @@ public struct PermutationGenerator<
765
765
///
766
766
/// - Requires: No preceding call to `self.next()` has returned `nil`.
767
767
public mutating func next( ) -> Element ? {
768
- let result = indices. next ( )
769
- return result != nil ? seq [ result!] : . None
768
+ return indices. next ( ) . map { seq [ $0] }
770
769
}
771
770
772
771
/// Construct a *generator* over a permutation of `elements` given
You can’t perform that action at this time.
0 commit comments