zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit e891f9cd9dc52b4bc63ae63115822fbf5e724348 (tree)
parent 6bd861006377ba192d5bd108a0de1e94f32c2454
Author: Andrew Kelley <superjoe30@gmail.com>
Date:   Wed, 20 Jun 2018 17:16:27 -0400

zig fmt

Diffstat:
Mstd/atomic/queue.zig | 2+-
Mstd/atomic/stack.zig | 2+-
Mstd/debug/index.zig | 6++----
Mstd/linked_list.zig | 6+++---
Mstd/mem.zig | 2+-
Mstd/os/index.zig | 4++--
Mtest/cases/null.zig | 2+-
7 files changed, 11 insertions(+), 13 deletions(-)

diff --git a/std/atomic/queue.zig b/std/atomic/queue.zig @@ -116,7 +116,7 @@ fn startPuts(ctx: *Context) u8 { const x = @bitCast(i32, r.random.scalar(u32)); const node = ctx.allocator.create(Queue(i32).Node{ .next = null, - .data = x + .data = x, }) catch unreachable; ctx.queue.put(node); _ = @atomicRmw(isize, &ctx.put_sum, builtin.AtomicRmwOp.Add, x, AtomicOrder.SeqCst); diff --git a/std/atomic/stack.zig b/std/atomic/stack.zig @@ -119,7 +119,7 @@ fn startPuts(ctx: *Context) u8 { const x = @bitCast(i32, r.random.scalar(u32)); const node = ctx.allocator.create(Stack(i32).Node{ .next = null, - .data = x + .data = x, }) catch unreachable; ctx.stack.push(node); _ = @atomicRmw(isize, &ctx.put_sum, builtin.AtomicRmwOp.Add, x, AtomicOrder.SeqCst); diff --git a/std/debug/index.zig b/std/debug/index.zig @@ -279,9 +279,7 @@ pub fn openSelfDebugInfo(allocator: *mem.Allocator) !*ElfStackTrace { var exe_file = try os.openSelfExe(); defer exe_file.close(); - const st = try allocator.create(ElfStackTrace{ - .symbol_table = try macho.loadSymbols(allocator, &io.FileInStream.init(&exe_file)) - }); + const st = try allocator.create(ElfStackTrace{ .symbol_table = try macho.loadSymbols(allocator, &io.FileInStream.init(&exe_file)) }); errdefer allocator.destroy(st); return st; }, @@ -972,7 +970,7 @@ fn scanAllCompileUnits(st: *ElfStackTrace) !void { try st.self_exe_file.seekTo(compile_unit_pos); - const compile_unit_die = try st.allocator().create( try parseDie(st, abbrev_table, is_64) ); + const compile_unit_die = try st.allocator().create(try parseDie(st, abbrev_table, is_64)); if (compile_unit_die.tag_id != DW.TAG_compile_unit) return error.InvalidDebugInfo; diff --git a/std/linked_list.zig b/std/linked_list.zig @@ -194,9 +194,9 @@ fn BaseLinkedList(comptime T: type, comptime ParentType: type, comptime field_na pub fn allocateNode(list: *Self, allocator: *Allocator) !*Node { comptime assert(!isIntrusive()); return allocator.create(Node{ - .prev = null, - .next = null, - .data = undefined + .prev = null, + .next = null, + .data = undefined, }); } diff --git a/std/mem.zig b/std/mem.zig @@ -44,7 +44,7 @@ pub const Allocator = struct { /// Alias of `create` /// Call `destroy` with the result pub fn construct(self: *Allocator, init: var) Error!*@typeOf(init) { - return self.create(init); + return self.create(init); } /// `ptr` should be the return value of `construct` or `create` diff --git a/std/os/index.zig b/std/os/index.zig @@ -2583,8 +2583,8 @@ pub fn spawnThread(context: var, comptime startFn: var) SpawnThreadError!*Thread errdefer assert(windows.HeapFree(heap_handle, 0, bytes_ptr) != 0); const bytes = @ptrCast([*]u8, bytes_ptr)[0..byte_count]; const outer_context = std.heap.FixedBufferAllocator.init(bytes).allocator.create(WinThread.OuterContext{ - .thread = undefined, - .inner = context + .thread = undefined, + .inner = context, }) catch unreachable; outer_context.thread.data.heap_handle = heap_handle; diff --git a/test/cases/null.zig b/test/cases/null.zig @@ -146,7 +146,7 @@ test "null with default unwrap" { test "optional types" { comptime { - const opt_type_struct = StructWithOptionalType { .t=u8, }; + const opt_type_struct = StructWithOptionalType{ .t = u8 }; assert(opt_type_struct.t != null and opt_type_struct.t.? == u8); } }