refactor: use contextual empty slice literals

This commit is contained in:
2026-10-25 01:21:02 +02:00
parent 678bb2583b
commit 2761c77182
7 changed files with 57 additions and 54 deletions
+2 -2
View File
@@ -13,7 +13,7 @@ ArrayList proc($T type) type {
#! retain `allocator` for later growth and cleanup; this call does not allocate.
init proc($T type, allocator mem.Allocator) ArrayList(T) {
return ArrayList(T) {
items = mem.empty(T),
items = &[],
capacity = 0,
allocator = allocator,
}
@@ -23,7 +23,7 @@ init proc($T type, allocator mem.Allocator) ArrayList(T) {
deinit proc($T type, list @mut ArrayList(T)) void {
allocation :: list.items.ptr[..list.capacity]
mem.free(list.allocator, allocation)
list.items = mem.empty(T)
list.items = &[]
list.capacity = 0
}