authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-12-05 21:32:07-08:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-01-15 15:11:35-08:00
logb9355edfb1db042098bc232cf8e52e079f4fcf4e
treedd82909008b8c755d8ce99f1d2a5fa5e6d679f34
parent943dac3e8558712096d55a30897057d75444178c

std.array_list: tiny refactor for pleasure


1 files changed, 2 insertions(+), 4 deletions(-)

lib/std/array_list.zig+2-4
......@@ -267,8 +267,7 @@ pub fn ArrayListAligned(comptime T: type, comptime alignment: ?u29) type {
267267 /// Never invalidates element pointers.
268268 /// Asserts that the list can hold one additional item.
269269 pub fn appendAssumeCapacity(self: *Self, item: T) void {
270 const new_item_ptr = self.addOneAssumeCapacity();
271 new_item_ptr.* = item;
270 self.addOneAssumeCapacity().* = item;
272271 }
273272
274273 /// Remove the element at index `i`, shift elements after index
......@@ -879,8 +878,7 @@ pub fn ArrayListAlignedUnmanaged(comptime T: type, comptime alignment: ?u29) typ
879878 /// Never invalidates element pointers.
880879 /// Asserts that the list can hold one additional item.
881880 pub fn appendAssumeCapacity(self: *Self, item: T) void {
882 const new_item_ptr = self.addOneAssumeCapacity();
883 new_item_ptr.* = item;
881 self.addOneAssumeCapacity().* = item;
884882 }
885883
886884 /// Remove the element at index `i` from the list and return its value.