Improve consistency of precondition failure messages

More uniform message strings should feel better, and they should ever so slightly reduce code size.
This commit is contained in:
Karoy Lorentey committed 2026-02-04 10:27:17 -08:00
1 parent b768d22393
commit 9503f8fe57
34 files changed
+84 -86

No files matched your search

@@ -20,7 +20,7 @@ extension BitArray {
toCount count: Int,
with padding: Bool = false
) {
precondition(count >= 0, "Negative count")
precondition(count >= 0, "Cannot set a negative count")
if count < _count {
_removeLast(self.count - count)
} else if count > _count {
@@ -35,7 +35,7 @@ extension BitArray {
count: Int,
at index: Int
) {
precondition(count >= 0, "Can't insert a negative number of values")
precondition(count >= 0, "Cannot add a negative number of items")
precondition(index >= 0 && index <= count, "Index out of bounds")
guard count > 0 else { return }
_extend(by: count, with: false)
@@ -44,7 +44,7 @@ extension BitArray {
}
public mutating func append(repeating value: Bool, count: Int) {
precondition(count >= 0, "Can't append a negative number of values")
precondition(count >= 0, "Cannot add a negative number of items")
guard count > 0 else { return }
_extend(by: count, with: value)
}