Skip to content

Commit ed5caaf

Browse files
make remove results discardable
1 parent c6a2b46 commit ed5caaf

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

Sources/SortedArray.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ extension SortedArray {
123123
/// - Parameter index: The position of the element to remove. `index` must be a valid index of the array.
124124
/// - Returns: The element at the specified index.
125125
/// - Complexity: O(_n_), where _n_ is the length of the array.
126+
@discardableResult
126127
public mutating func remove(at index: Int) -> Element {
127128
return _elements.remove(at: index)
128129
}
@@ -184,6 +185,7 @@ extension SortedArray {
184185
/// - Precondition: The array must not be empty.
185186
/// - Returns: The removed element.
186187
/// - Complexity: O(_n_), where _n_ is the length of the collection.
188+
@discardableResult
187189
public mutating func removeFirst() -> Element {
188190
return _elements.removeFirst()
189191
}
@@ -193,6 +195,7 @@ extension SortedArray {
193195
/// - Precondition: The collection must not be empty.
194196
/// - Returns: The last element of the collection.
195197
/// - Complexity: O(1)
198+
@discardableResult
196199
public mutating func removeLast() -> Element {
197200
return _elements.removeLast()
198201
}

0 commit comments

Comments
 (0)