diff --git a/exercises/053_slices2.zig b/exercises/053_slices2.zig index 18237a0..545b4da 100644 --- a/exercises/053_slices2.zig +++ b/exercises/053_slices2.zig @@ -31,5 +31,5 @@ pub fn main() void { } fn printPhrase(part1: []u8, part2: []u8, part3: []u8) void { - std.debug.print("'{s} {s} {s}.' ", .{part1, part2, part3}); + std.debug.print("'{s} {s} {s}.' ", .{ part1, part2, part3 }); } diff --git a/exercises/064_builtins.zig b/exercises/064_builtins.zig index cd0d717..e1af861 100644 --- a/exercises/064_builtins.zig +++ b/exercises/064_builtins.zig @@ -54,7 +54,7 @@ pub fn main() void { // // Also, check out our fancy formatting! b:0>4 means, "print // as a binary number, zero-pad right-aligned four digits." - print("{b:0>4} + {b:0>4} = {b:0>4} ({})", .{a, b, my_result, overflowed}); + print("{b:0>4} + {b:0>4} = {b:0>4} ({})", .{ a, b, my_result, overflowed }); print(". Furthermore, ", .{}); @@ -70,5 +70,5 @@ pub fn main() void { // this builtin to reverse the bits of a u8 integer. const input: u8 = 0b11110000; const tupni: u8 = @bitReverse(input); - print("{b:0>8} backwards is {b:0>8}.\n", .{input, tupni}); + print("{b:0>8} backwards is {b:0>8}.\n", .{ input, tupni }); } diff --git a/exercises/065_builtins2.zig b/exercises/065_builtins2.zig index c9257ff..1532c2a 100644 --- a/exercises/065_builtins2.zig +++ b/exercises/065_builtins2.zig @@ -53,7 +53,7 @@ const Narcissus = struct { }; pub fn main() void { - var narcissus: Narcissus = Narcissus {}; + var narcissus: Narcissus = Narcissus{}; // Oops! We cannot leave the 'me' and 'myself' fields // undefined. Please set them here: @@ -70,7 +70,7 @@ pub fn main() void { // fix this call: const T2 = narcissus.fetchTheMostBeautifulType(); - print("A {} loves all {}es. ", .{T1, T2}); + print("A {} loves all {}es. ", .{ T1, T2 }); // His final words as he was looking in // those waters he habitually watched diff --git a/exercises/066_comptime.zig b/exercises/066_comptime.zig index 40c7fdb..bcd0bc5 100644 --- a/exercises/066_comptime.zig +++ b/exercises/066_comptime.zig @@ -30,7 +30,7 @@ // const print = @import("std").debug.print; -pub fn main() void { +pub fn main() void { // ALL numeric literals in Zig are of type comptime_int or // comptime_float. They are of arbitrary size (as big or // little as you need). @@ -46,7 +46,7 @@ pub fn main() void { const const_int = 12345; const const_float = 987.654; - print("Immutable: {}, {d:.3}; ", .{const_int, const_float}); + print("Immutable: {}, {d:.3}; ", .{ const_int, const_float }); // But something changes when we assign the exact same values // to identifiers mutably with "var". @@ -69,7 +69,7 @@ pub fn main() void { var_int = 54321; var_float = 456.789; - print("Mutable: {}, {d:.3}; ", .{var_int, var_float}); + print("Mutable: {}, {d:.3}; ", .{ var_int, var_float }); // Bonus: Now that we're familiar with Zig's builtins, we can // also inspect the types to see what they are, no guessing diff --git a/exercises/067_comptime2.zig b/exercises/067_comptime2.zig index 6299dd9..7d4bdb0 100644 --- a/exercises/067_comptime2.zig +++ b/exercises/067_comptime2.zig @@ -30,7 +30,7 @@ // const print = @import("std").debug.print; -pub fn main() void { +pub fn main() void { // // In this contrived example, we've decided to allocate some // arrays using a variable count! But something's missing... @@ -49,7 +49,7 @@ pub fn main() void { count += 1; var a4: [count]u8 = .{'D'} ** count; - print("{s} {s} {s} {s}\n", .{a1, a2, a3, a4}); + print("{s} {s} {s} {s}\n", .{ a1, a2, a3, a4 }); // Builtin BONUS! // diff --git a/exercises/068_comptime3.zig b/exercises/068_comptime3.zig index ebe6c8f..848d7d2 100644 --- a/exercises/068_comptime3.zig +++ b/exercises/068_comptime3.zig @@ -61,10 +61,10 @@ const Schooner = struct { } }; -pub fn main() void { - var whale = Schooner {.name = "Whale"}; - var shark = Schooner {.name = "Shark"}; - var minnow = Schooner {.name = "Minnow"}; +pub fn main() void { + var whale = Schooner{ .name = "Whale" }; + var shark = Schooner{ .name = "Shark" }; + var minnow = Schooner{ .name = "Minnow" }; // Hey, we can't just pass this runtime variable as an // argument to the scaleMe() method. What would let us do diff --git a/exercises/069_comptime4.zig b/exercises/069_comptime4.zig index 1cd3571..ecec2ee 100644 --- a/exercises/069_comptime4.zig +++ b/exercises/069_comptime4.zig @@ -13,14 +13,14 @@ // const print = @import("std").debug.print; -pub fn main() void { +pub fn main() void { // Here we declare arrays of three different types and sizes // at compile time from a function call. Neat! const s1 = makeSequence(u8, 3); // creates a [3]u8 const s2 = makeSequence(u32, 5); // creates a [5]u32 const s3 = makeSequence(i64, 7); // creates a [7]i64 - print("s1={any}, s2={any}, s3={any}\n", .{s1, s2, s3}); + print("s1={any}, s2={any}, s3={any}\n", .{ s1, s2, s3 }); } // This function is pretty wild because it executes at runtime diff --git a/exercises/075_quiz8.zig b/exercises/075_quiz8.zig index 61c8f6f..1e026a4 100644 --- a/exercises/075_quiz8.zig +++ b/exercises/075_quiz8.zig @@ -54,12 +54,12 @@ fn makePath(from: *Place, to: *Place, dist: u8) Path { // Using our new function, these path definitions take up considerably less // space in our program now! -const a_paths = [_]Path{ makePath(&a, &b, 2) }; +const a_paths = [_]Path{makePath(&a, &b, 2)}; const b_paths = [_]Path{ makePath(&b, &a, 2), makePath(&b, &d, 1) }; const c_paths = [_]Path{ makePath(&c, &d, 3), makePath(&c, &e, 2) }; const d_paths = [_]Path{ makePath(&d, &b, 1), makePath(&d, &c, 3), makePath(&d, &f, 7) }; const e_paths = [_]Path{ makePath(&e, &c, 2), makePath(&e, &f, 1) }; -const f_paths = [_]Path{ makePath(&f, &d, 7) }; +const f_paths = [_]Path{makePath(&f, &d, 7)}; // // But is it more readable? That could be argued either way. // diff --git a/exercises/077_sentinels2.zig b/exercises/077_sentinels2.zig index dd4a839..fb8f13d 100644 --- a/exercises/077_sentinels2.zig +++ b/exercises/077_sentinels2.zig @@ -50,7 +50,7 @@ pub fn main() void { // // Luckily, the 'length' field makes it possible to still // work with this value. - const foo = WeirdContainer { + const foo = WeirdContainer{ .data = "Weird Data!", .length = 11, }; diff --git a/exercises/089_async6.zig b/exercises/089_async6.zig index 755b438..8bf50e9 100644 --- a/exercises/089_async6.zig +++ b/exercises/089_async6.zig @@ -44,7 +44,7 @@ pub fn main() void { var com_title = com_frame; var org_title = org_frame; - print(".com: {s}, .org: {s}.\n", .{com_title, org_title}); + print(".com: {s}, .org: {s}.\n", .{ com_title, org_title }); } fn getPageTitle(url: []const u8) []const u8 {