aboutsummaryrefslogtreecommitdiff
path: root/lib/std/array_list.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2024-12-05 21:32:07 -0800
committerAndrew Kelley <andrew@ziglang.org>2025-01-15 15:11:35 -0800
commitb9355edfb1db042098bc232cf8e52e079f4fcf4e (patch)
treedd82909008b8c755d8ce99f1d2a5fa5e6d679f34 /lib/std/array_list.zig
parent943dac3e8558712096d55a30897057d75444178c (diff)
downloadzig-b9355edfb1db042098bc232cf8e52e079f4fcf4e.tar.gz
zig-b9355edfb1db042098bc232cf8e52e079f4fcf4e.zip
std.array_list: tiny refactor for pleasure
Diffstat (limited to 'lib/std/array_list.zig')
-rw-r--r--lib/std/array_list.zig6
1 files changed, 2 insertions, 4 deletions
diff --git a/lib/std/array_list.zig b/lib/std/array_list.zig
index 197b8c7fba..5eb527e742 100644
--- a/lib/std/array_list.zig
+++ b/lib/std/array_list.zig
@@ -267,8 +267,7 @@ pub fn ArrayListAligned(comptime T: type, comptime alignment: ?u29) type {
/// Never invalidates element pointers.
/// Asserts that the list can hold one additional item.
pub fn appendAssumeCapacity(self: *Self, item: T) void {
- const new_item_ptr = self.addOneAssumeCapacity();
- new_item_ptr.* = item;
+ self.addOneAssumeCapacity().* = item;
}
/// Remove the element at index `i`, shift elements after index
@@ -879,8 +878,7 @@ pub fn ArrayListAlignedUnmanaged(comptime T: type, comptime alignment: ?u29) typ
/// Never invalidates element pointers.
/// Asserts that the list can hold one additional item.
pub fn appendAssumeCapacity(self: *Self, item: T) void {
- const new_item_ptr = self.addOneAssumeCapacity();
- new_item_ptr.* = item;
+ self.addOneAssumeCapacity().* = item;
}
/// Remove the element at index `i` from the list and return its value.