Skip to content

Commit b68955d

Browse files
author
Matt Zanchelli
committed
Avoid redundant index comparison
1 parent e6b7cc6 commit b68955d

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

Tests/SwiftAlgorithmsTests/TestUtilities.swift

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,7 @@ func XCTAssertUnorderedEqualSequences<S1: Sequence, S2: Sequence>(
111111
// an element at an index in the middle of the array, which requires
112112
// shifting all subsequent elements down.
113113
let lastIdx = s1.index(before: s1.endIndex)
114-
if lastIdx != idx {
115-
s1.swapAt(idx, lastIdx)
116-
}
114+
s1.swapAt(idx, lastIdx)
117115
s1.remove(at: lastIdx)
118116
}
119117

0 commit comments

Comments
 (0)