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 {
256256 """
257257 )
258258
259+ // Make sure we are within bounds.
260+ let prefixCount = Swift . min ( count, self . count)
261+
259262 // Do nothing if we're prefixing nothing.
260- guard count > 0 else {
263+ guard prefixCount > 0 else {
261264 return [ ]
262265 }
263266
264- // Make sure we are within bounds.
265- let prefixCount = Swift . min ( count, self . count)
266-
267267 // If we're attempting to prefix more than 10% of the collection, it's
268268 // faster to sort everything.
269269 guard prefixCount < ( self . count / 10 ) else {
@@ -310,14 +310,14 @@ extension Collection {
310310 """
311311 )
312312
313+ // Make sure we are within bounds.
314+ let suffixCount = Swift . min ( count, self . count)
315+
313316 // Do nothing if we're suffixing nothing.
314- guard count > 0 else {
317+ guard suffixCount > 0 else {
315318 return [ ]
316319 }
317320
318- // Make sure we are within bounds.
319- let suffixCount = Swift . min ( count, self . count)
320-
321321 // If we're attempting to prefix more than 10% of the collection, it's
322322 // faster to sort everything.
323323 guard suffixCount < ( self . count / 10 ) else {
You can’t perform that action at this time.
0 commit comments