aboutsummaryrefslogtreecommitdiff
path: root/std/buffer.zig
diff options
context:
space:
mode:
Diffstat (limited to 'std/buffer.zig')
-rw-r--r--std/buffer.zig11
1 files changed, 3 insertions, 8 deletions
diff --git a/std/buffer.zig b/std/buffer.zig
index 041d891dec..cf530c3c9e 100644
--- a/std/buffer.zig
+++ b/std/buffer.zig
@@ -31,9 +31,7 @@ pub const Buffer = struct {
/// * ::replaceContentsBuffer
/// * ::resize
pub fn initNull(allocator: &Allocator) Buffer {
- return Buffer {
- .list = ArrayList(u8).init(allocator),
- };
+ return Buffer{ .list = ArrayList(u8).init(allocator) };
}
/// Must deinitialize with deinit.
@@ -45,9 +43,7 @@ pub const Buffer = struct {
/// allocated with `allocator`.
/// Must deinitialize with deinit.
pub fn fromOwnedSlice(allocator: &Allocator, slice: []u8) Buffer {
- var self = Buffer {
- .list = ArrayList(u8).fromOwnedSlice(allocator, slice),
- };
+ var self = Buffer{ .list = ArrayList(u8).fromOwnedSlice(allocator, slice) };
self.list.append(0);
return self;
}
@@ -57,11 +53,10 @@ pub const Buffer = struct {
pub fn toOwnedSlice(self: &Buffer) []u8 {
const allocator = self.list.allocator;
const result = allocator.shrink(u8, self.list.items, self.len());
- *self = initNull(allocator);
+ self.* = initNull(allocator);
return result;
}
-
pub fn deinit(self: &Buffer) void {
self.list.deinit();
}