Skip to content

Commit e27ec45

Browse files
committed
Cleanup: Iterator.Element -> Element
1 parent 7609357 commit e27ec45

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

Sources/SortedArray.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public struct SortedArray<Element> {
1919
}
2020

2121
/// Initializes the array with a sequence of unsorted elements and a comparison predicate.
22-
public init<S: Sequence>(unsorted: S, areInIncreasingOrder: @escaping Comparator<Element>) where S.Iterator.Element == Element {
22+
public init<S: Sequence>(unsorted: S, areInIncreasingOrder: @escaping Comparator<Element>) where S.Element == Element {
2323
let sorted = unsorted.sorted(by: areInIncreasingOrder)
2424
self._elements = sorted
2525
self.areInIncreasingOrder = areInIncreasingOrder
@@ -30,7 +30,7 @@ public struct SortedArray<Element> {
3030
/// This is faster than `init(unsorted:areInIncreasingOrder:)` because the elements don't have to sorted again.
3131
///
3232
/// - Precondition: `sorted` is sorted according to the given comparison predicate. If you violate this condition, the behavior is undefined.
33-
public init<S: Sequence>(sorted: S, areInIncreasingOrder: @escaping Comparator<Element>) where S.Iterator.Element == Element {
33+
public init<S: Sequence>(sorted: S, areInIncreasingOrder: @escaping Comparator<Element>) where S.Element == Element {
3434
self._elements = Array(sorted)
3535
self.areInIncreasingOrder = areInIncreasingOrder
3636
}
@@ -55,7 +55,7 @@ public struct SortedArray<Element> {
5555
/// we only need to re-sort once.
5656
///
5757
/// - Complexity: O(_n * log(n)_) where _n_ is the size of the resulting array.
58-
public mutating func insert<S: Sequence>(contentsOf newElements: S) where S.Iterator.Element == Element {
58+
public mutating func insert<S: Sequence>(contentsOf newElements: S) where S.Element == Element {
5959
_elements.append(contentsOf: newElements)
6060
_elements.sort(by: areInIncreasingOrder)
6161
}
@@ -68,7 +68,7 @@ extension SortedArray where Element: Comparable {
6868
}
6969

7070
/// Initializes the array with a sequence of unsorted elements. Uses `<` as the comparison predicate.
71-
public init<S: Sequence>(unsorted: S) where S.Iterator.Element == Element {
71+
public init<S: Sequence>(unsorted: S) where S.Element == Element {
7272
self.init(unsorted: unsorted, areInIncreasingOrder: <)
7373
}
7474

@@ -77,7 +77,7 @@ extension SortedArray where Element: Comparable {
7777
/// This is faster than `init(unsorted:)` because the elements don't have to sorted again.
7878
///
7979
/// - Precondition: `sorted` is sorted according to the `<` predicate. If you violate this condition, the behavior is undefined.
80-
public init<S: Sequence>(sorted: S) where S.Iterator.Element == Element {
80+
public init<S: Sequence>(sorted: S) where S.Element == Element {
8181
self.init(sorted: sorted, areInIncreasingOrder: <)
8282
}
8383
}

Tests/UnitTests/TestHelpers.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import XCTest
22

33
func assertElementsEqual<S1, S2>(_ expression1: @autoclosure () throws -> S1, _ expression2: @autoclosure () throws -> S2, _ message: @autoclosure () -> String = "", file: StaticString = #file, line: UInt = #line)
4-
where S1: Sequence, S2: Sequence, S1.Iterator.Element == S2.Iterator.Element, S1.Iterator.Element: Equatable {
4+
where S1: Sequence, S2: Sequence, S1.Element == S2.Element, S1.Element: Equatable {
55

66
// This should give a better error message than using XCTAssert(try expression1().elementsEqual(expression2()), ...)
77
XCTAssertEqual(Array(try expression1()), Array(try expression2()), message, file: file, line: line)

0 commit comments

Comments
 (0)