diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2018-06-14 18:27:59 -0400 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2018-06-14 18:27:59 -0400 |
| commit | 32dd98b19fe3cc384df32704dac0ff3e377dbe0c (patch) | |
| tree | 2eddf3618d80313bdd24c25bd589bd474f3d82fc /std/linked_list.zig | |
| parent | ef7f69d14a017c6c2065e4a376bb8e1f05ace04b (diff) | |
| parent | f0697c28f80d64c544302aea576e41ebc443b41c (diff) | |
| download | zig-32dd98b19fe3cc384df32704dac0ff3e377dbe0c.tar.gz zig-32dd98b19fe3cc384df32704dac0ff3e377dbe0c.zip | |
Merge remote-tracking branch 'origin/master' into llvm7
Diffstat (limited to 'std/linked_list.zig')
| -rw-r--r-- | std/linked_list.zig | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/std/linked_list.zig b/std/linked_list.zig index fbc0a0c42a..9e32b7d9da 100644 --- a/std/linked_list.zig +++ b/std/linked_list.zig @@ -169,7 +169,7 @@ fn BaseLinkedList(comptime T: type, comptime ParentType: type, comptime field_na /// Returns: /// A pointer to the last node in the list. pub fn pop(list: *Self) ?*Node { - const last = list.last ?? return null; + const last = list.last orelse return null; list.remove(last); return last; } @@ -179,7 +179,7 @@ fn BaseLinkedList(comptime T: type, comptime ParentType: type, comptime field_na /// Returns: /// A pointer to the first node in the list. pub fn popFirst(list: *Self) ?*Node { - const first = list.first ?? return null; + const first = list.first orelse return null; list.remove(first); return first; } @@ -270,8 +270,8 @@ test "basic linked list test" { var last = list.pop(); // {2, 3, 4} list.remove(three); // {2, 4} - assert((??list.first).data == 2); - assert((??list.last).data == 4); + assert(list.first.?.data == 2); + assert(list.last.?.data == 4); assert(list.len == 2); } @@ -336,7 +336,7 @@ test "basic intrusive linked list test" { var last = list.pop(); // {2, 3, 4} list.remove(&three.link); // {2, 4} - assert((??list.first).toData().value == 2); - assert((??list.last).toData().value == 4); + assert(list.first.?.toData().value == 2); + assert(list.last.?.toData().value == 4); assert(list.len == 2); } |
