Skip to content

Commit 25e7cce

Browse files
author
Daniel Dahan
committed
development: removed all warnings
1 parent a945a1d commit 25e7cce

File tree

3 files changed

+12
-16
lines changed

3 files changed

+12
-16
lines changed

Examples/Algorithm.xcworkspace/contents.xcworkspacedata

Lines changed: 0 additions & 7 deletions
This file was deleted.

Sources/DoublyLinkedList.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ public class DoublyLinkedList<Element>: CustomStringConvertible, Sequence {
125125
to that node.
126126
- returns: Element?
127127
*/
128-
public var next: Element? {
128+
public var next: Element? {
129129
current = current?.next
130130
return current?.element
131131
}
@@ -237,6 +237,7 @@ public class DoublyLinkedList<Element>: CustomStringConvertible, Sequence {
237237
and return the element at the poistion.
238238
- returns: Element?
239239
*/
240+
@discardableResult
240241
public func removeAtFront() -> Element? {
241242
if 0 == count {
242243
return nil
@@ -280,6 +281,7 @@ public class DoublyLinkedList<Element>: CustomStringConvertible, Sequence {
280281
and return the element at the poistion.
281282
- returns: Element?
282283
*/
284+
@discardableResult
283285
public func removeAtBack() -> Element? {
284286
if 0 == count {
285287
return nil
@@ -345,6 +347,7 @@ public class DoublyLinkedList<Element>: CustomStringConvertible, Sequence {
345347
:description: Removes the element at the cursor position.
346348
- returns: Element?
347349
*/
350+
@discardableResult
348351
public func removeAtCursor() -> Element? {
349352
if 1 >= count {
350353
return removeAtFront()

Tests/DoublyLinkedListTests.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,12 @@ class DoublyLinkedListTests: XCTestCase {
5959

6060
l.cursorToFront()
6161
while !l.isCursorAtBack {
62-
l.next
62+
_ = l.next
6363
}
6464

6565
l.cursorToBack()
6666
while !l.isCursorAtFront {
67-
l.previous
67+
_ = l.previous
6868
}
6969

7070
XCTAssert(6 == l.count, "Count incorrect, got \(l.count).")
@@ -115,16 +115,16 @@ class DoublyLinkedListTests: XCTestCase {
115115
XCTAssert(1 == l.cursor && 1 == l.count, "Test failed, got \(l.cursor)")
116116
l.insertAfterCursor(2)
117117
l.insertAfterCursor(6)
118-
l.next
119-
XCTAssert(6 == l.cursor && 3 == l.count, "Test failed, got \(l.cursor)")
118+
_ = l.next
119+
XCTAssert(6 == l.cursor && 3 == l.count, "Test failed, got \(l.cursor)")
120120
l.insertBeforeCursor(3)
121121
l.insertBeforeCursor(5)
122-
l.previous
123-
XCTAssert(5 == l.cursor && 5 == l.count, "Test failed, got \(l.cursor)")
122+
_ = l.previous
123+
XCTAssert(5 == l.cursor && 5 == l.count, "Test failed, got \(l.cursor)")
124124
l.insertAtBack(4)
125-
l.previous
125+
_ = l.previous
126126
l.removeAtCursor()
127-
XCTAssert(5 == l.cursor && 5 == l.count, "Test failed, got \(l.cursor)")
127+
XCTAssert(5 == l.cursor && 5 == l.count, "Test failed, got \(l.cursor)")
128128
l.removeAtCursor()
129129
XCTAssert(6 == l.cursor && 4 == l.count, "Test failed, got \(l.cursor)")
130130
l.removeAtCursor()

0 commit comments

Comments
 (0)