We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fc8fdfd commit eaa141dCopy full SHA for eaa141d
Sources/Algorithms/MinMax.swift
@@ -310,14 +310,14 @@ extension Collection {
310
"""
311
)
312
313
+ // Make sure we are within bounds.
314
+ let suffixCount = Swift.min(count, self.count)
315
+
316
// Do nothing if we're suffixing nothing.
- guard count > 0 else {
317
+ guard suffixCount > 0 else {
318
return []
319
}
320
- // Make sure we are within bounds.
- let suffixCount = Swift.min(count, self.count)
-
321
// If we're attempting to prefix more than 10% of the collection, it's
322
// faster to sort everything.
323
guard suffixCount < (self.count / 10) else {
0 commit comments