diff --git a/Sources/Algorithms/MinMax.swift b/Sources/Algorithms/MinMax.swift index 3bce4af..ea6b5a7 100644 --- a/Sources/Algorithms/MinMax.swift +++ b/Sources/Algorithms/MinMax.swift @@ -256,13 +256,13 @@ extension Collection { """ ) - // Do nothing if we're prefixing nothing. - guard count > 0 else { - return [] - } - // Make sure we are within bounds. let prefixCount = Swift.min(count, self.count) + + // Do nothing if we're prefixing nothing. + guard prefixCount > 0 else { + return [] + } // If we're attempting to prefix more than 10% of the collection, it's // faster to sort everything. @@ -310,13 +310,13 @@ extension Collection { """ ) - // Do nothing if we're suffixing nothing. - guard count > 0 else { - return [] - } - // Make sure we are within bounds. let suffixCount = Swift.min(count, self.count) + + // Do nothing if we're suffixing nothing. + guard suffixCount > 0 else { + return [] + } // If we're attempting to prefix more than 10% of the collection, it's // faster to sort everything.