diff --git a/Sources/SortedCollections/BTree/_BTree+UnsafeCursor.swift b/Sources/SortedCollections/BTree/_BTree+UnsafeCursor.swift index 454fb882..2cffdb49 100644 --- a/Sources/SortedCollections/BTree/_BTree+UnsafeCursor.swift +++ b/Sources/SortedCollections/BTree/_BTree+UnsafeCursor.swift @@ -487,7 +487,7 @@ extension _BTree { if shouldStop { break } } - assert(slot != -1, "B-Tree sanity check fail.") + assert(slot != -1) parents.append(node) slots.append(UInt16(slot)) diff --git a/Sources/SortedCollections/BTree/_BTree.swift b/Sources/SortedCollections/BTree/_BTree.swift index f914f252..2cbf69f1 100644 --- a/Sources/SortedCollections/BTree/_BTree.swift +++ b/Sources/SortedCollections/BTree/_BTree.swift @@ -513,8 +513,7 @@ extension _BTree { node.read({ handle in let slot = handle.endSlot(forKey: key) - 1 if slot > 0 { - // Sanity Check - assert(slot < handle.elementCount, "Slot out of bounds.") + assert(slot < handle.elementCount, "Slot out of bounds") if handle.isLeaf { offset += slot diff --git a/Sources/SortedCollections/BTree/_Node.UnsafeHandle+Deletion.swift b/Sources/SortedCollections/BTree/_Node.UnsafeHandle+Deletion.swift index d96a7b7b..1d9446f0 100644 --- a/Sources/SortedCollections/BTree/_Node.UnsafeHandle+Deletion.swift +++ b/Sources/SortedCollections/BTree/_Node.UnsafeHandle+Deletion.swift @@ -57,8 +57,7 @@ extension _Node.UnsafeHandle { // not exist. return nil } else { - // Sanity-check - assert(slot < self.childCount, "Attempt to remove from invalid child.") + assert(slot < self.childCount, "Attempt to remove from invalid child") let removedElement = self[childAt: slot].update({ $0.removeAnyElement(forKey: key)