From e891f9cd9dc52b4bc63ae63115822fbf5e724348 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Wed, 20 Jun 2018 17:16:27 -0400 Subject: [PATCH] zig fmt --- std/atomic/queue.zig | 2 +- std/atomic/stack.zig | 2 +- std/debug/index.zig | 6 ++---- std/linked_list.zig | 6 +++--- std/mem.zig | 2 +- std/os/index.zig | 4 ++-- test/cases/null.zig | 2 +- 7 files changed, 11 insertions(+), 13 deletions(-) diff --git a/std/atomic/queue.zig b/std/atomic/queue.zig index 5b810f95ac..308cd6c736 100644 --- 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 index 2272be4a92..011ab3254f 100644 --- 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 index 19cee3c65d..57b2dfc300 100644 --- 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 index f4f7aab752..128ccdf4b1 100644 --- 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 index 18fc386b47..29f5f924c8 100644 --- 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 index 7b69bd0b36..ce29106810 100644 --- 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 index d2a9aaed55..c86dd34b06 100644 --- 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); } }