Skip to content

Commit 6568f0f

Browse files
authored
Merge pull request #25705 from squeek502/linked-list-remove-docs
Document that `remove` of Singly/DoublyLinkedList relies on the node being in the list
2 parents b409cdf + 63a45b8 commit 6568f0f

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

lib/std/DoublyLinkedList.zig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ pub fn prepend(list: *DoublyLinkedList, new_node: *Node) void {
105105
}
106106

107107
/// Remove a node from the list.
108+
/// Assumes the node is in the list.
108109
///
109110
/// Arguments:
110111
/// node: Pointer to the node to be removed.

lib/std/SinglyLinkedList.zig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ pub fn prepend(list: *SinglyLinkedList, new_node: *Node) void {
8585
list.first = new_node;
8686
}
8787

88+
/// Remove `node` from the list.
89+
/// Asserts that `node` is in the list.
8890
pub fn remove(list: *SinglyLinkedList, node: *Node) void {
8991
if (list.first == node) {
9092
list.first = node.next;

0 commit comments

Comments
 (0)