Skip to content

Commit 20c5f7f

Browse files
committed
remove unnecessary indirection
'Sequence' has an 'Element' typealias as of swiftlang/swift#9589, which was first included in a Swift 4 snapshot on 2017-05-15-a.
1 parent 7e14bfd commit 20c5f7f

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

Whats-new-in-Swift-4.playground/Pages/Generic subscripts.xcplaygroundpage/Contents.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ let population: Int? = json["population"]
3434
Another example: a subscript on `Collection` that takes a generic sequence of indices and returns an array of the values at these indices:
3535
*/
3636
extension Collection {
37-
subscript<Indices: Sequence>(indices indices: Indices) -> [Iterator.Element] where Indices.Iterator.Element == Index {
37+
subscript<Indices: Sequence>(indices indices: Indices) -> [Element] where Indices.Element == Index {
3838
var result: [Element] = []
3939
for index in indices {
4040
result.append(self[index])

Whats-new-in-Swift-4.playground/Pages/reduce with inout.xcplaygroundpage/Contents.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
SE-0171 is not implemented yet.
1111
*/
1212
// Not implemented yet
13-
//extension Sequence where Iterator.Element: Equatable {
14-
// func uniq() -> [Iterator.Element] {
15-
// return reduce(into: []) { (result: inout [Iterator.Element], element) in
13+
//extension Sequence where Element: Equatable {
14+
// func uniq() -> [Element] {
15+
// return reduce(into: []) { (result: inout [Element], element) in
1616
// if result.last != element {
1717
// result.append(element)
1818
// }

0 commit comments

Comments
 (0)