File tree Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -256,14 +256,14 @@ extension Collection {
256
256
"""
257
257
)
258
258
259
+ // Make sure we are within bounds.
260
+ let prefixCount = Swift . min ( count, self . count)
261
+
259
262
// Do nothing if we're prefixing nothing.
260
- guard count > 0 else {
263
+ guard prefixCount > 0 else {
261
264
return [ ]
262
265
}
263
266
264
- // Make sure we are within bounds.
265
- let prefixCount = Swift . min ( count, self . count)
266
-
267
267
// If we're attempting to prefix more than 10% of the collection, it's
268
268
// faster to sort everything.
269
269
guard prefixCount < ( self . count / 10 ) else {
@@ -310,14 +310,14 @@ extension Collection {
310
310
"""
311
311
)
312
312
313
+ // Make sure we are within bounds.
314
+ let suffixCount = Swift . min ( count, self . count)
315
+
313
316
// Do nothing if we're suffixing nothing.
314
- guard count > 0 else {
317
+ guard suffixCount > 0 else {
315
318
return [ ]
316
319
}
317
320
318
- // Make sure we are within bounds.
319
- let suffixCount = Swift . min ( count, self . count)
320
-
321
321
// If we're attempting to prefix more than 10% of the collection, it's
322
322
// faster to sort everything.
323
323
guard suffixCount < ( self . count / 10 ) else {
You can’t perform that action at this time.
0 commit comments