Commit 5f35dc0c0d

Andrew Kelley <andrew@ziglang.org>
2021-02-25 05:29:01
zig fmt the std lib
1 parent d7049fc
lib/std/c/builtins.zig
@@ -6,12 +6,22 @@
 
 const std = @import("std");
 
-pub fn __builtin_bswap16(val: u16) callconv(.Inline) u16 { return @byteSwap(u16, val); }
-pub fn __builtin_bswap32(val: u32) callconv(.Inline) u32 { return @byteSwap(u32, val); }
-pub fn __builtin_bswap64(val: u64) callconv(.Inline) u64 { return @byteSwap(u64, val); }
+pub fn __builtin_bswap16(val: u16) callconv(.Inline) u16 {
+    return @byteSwap(u16, val);
+}
+pub fn __builtin_bswap32(val: u32) callconv(.Inline) u32 {
+    return @byteSwap(u32, val);
+}
+pub fn __builtin_bswap64(val: u64) callconv(.Inline) u64 {
+    return @byteSwap(u64, val);
+}
 
-pub fn __builtin_signbit(val: f64) callconv(.Inline) c_int { return @boolToInt(std.math.signbit(val)); }
-pub fn __builtin_signbitf(val: f32) callconv(.Inline) c_int { return @boolToInt(std.math.signbit(val)); }
+pub fn __builtin_signbit(val: f64) callconv(.Inline) c_int {
+    return @boolToInt(std.math.signbit(val));
+}
+pub fn __builtin_signbitf(val: f32) callconv(.Inline) c_int {
+    return @boolToInt(std.math.signbit(val));
+}
 
 pub fn __builtin_popcount(val: c_uint) callconv(.Inline) c_int {
     // popcount of a c_uint will never exceed the capacity of a c_int
@@ -31,40 +41,96 @@ pub fn __builtin_clz(val: c_uint) callconv(.Inline) c_int {
     return @bitCast(c_int, @as(c_uint, @clz(c_uint, val)));
 }
 
-pub fn __builtin_sqrt(val: f64) callconv(.Inline) f64 { return @sqrt(val); }
-pub fn __builtin_sqrtf(val: f32) callconv(.Inline) f32 { return @sqrt(val); }
+pub fn __builtin_sqrt(val: f64) callconv(.Inline) f64 {
+    return @sqrt(val);
+}
+pub fn __builtin_sqrtf(val: f32) callconv(.Inline) f32 {
+    return @sqrt(val);
+}
 
-pub fn __builtin_sin(val: f64) callconv(.Inline) f64 { return @sin(val); }
-pub fn __builtin_sinf(val: f32) callconv(.Inline) f32 { return @sin(val); }
-pub fn __builtin_cos(val: f64) callconv(.Inline) f64 { return @cos(val); }
-pub fn __builtin_cosf(val: f32) callconv(.Inline) f32 { return @cos(val); }
+pub fn __builtin_sin(val: f64) callconv(.Inline) f64 {
+    return @sin(val);
+}
+pub fn __builtin_sinf(val: f32) callconv(.Inline) f32 {
+    return @sin(val);
+}
+pub fn __builtin_cos(val: f64) callconv(.Inline) f64 {
+    return @cos(val);
+}
+pub fn __builtin_cosf(val: f32) callconv(.Inline) f32 {
+    return @cos(val);
+}
 
-pub fn __builtin_exp(val: f64) callconv(.Inline) f64 { return @exp(val); }
-pub fn __builtin_expf(val: f32) callconv(.Inline) f32 { return @exp(val); }
-pub fn __builtin_exp2(val: f64) callconv(.Inline) f64 { return @exp2(val); }
-pub fn __builtin_exp2f(val: f32) callconv(.Inline) f32 { return @exp2(val); }
-pub fn __builtin_log(val: f64) callconv(.Inline) f64 { return @log(val); }
-pub fn __builtin_logf(val: f32) callconv(.Inline) f32 { return @log(val); }
-pub fn __builtin_log2(val: f64) callconv(.Inline) f64 { return @log2(val); }
-pub fn __builtin_log2f(val: f32) callconv(.Inline) f32 { return @log2(val); }
-pub fn __builtin_log10(val: f64) callconv(.Inline) f64 { return @log10(val); }
-pub fn __builtin_log10f(val: f32) callconv(.Inline) f32 { return @log10(val); }
+pub fn __builtin_exp(val: f64) callconv(.Inline) f64 {
+    return @exp(val);
+}
+pub fn __builtin_expf(val: f32) callconv(.Inline) f32 {
+    return @exp(val);
+}
+pub fn __builtin_exp2(val: f64) callconv(.Inline) f64 {
+    return @exp2(val);
+}
+pub fn __builtin_exp2f(val: f32) callconv(.Inline) f32 {
+    return @exp2(val);
+}
+pub fn __builtin_log(val: f64) callconv(.Inline) f64 {
+    return @log(val);
+}
+pub fn __builtin_logf(val: f32) callconv(.Inline) f32 {
+    return @log(val);
+}
+pub fn __builtin_log2(val: f64) callconv(.Inline) f64 {
+    return @log2(val);
+}
+pub fn __builtin_log2f(val: f32) callconv(.Inline) f32 {
+    return @log2(val);
+}
+pub fn __builtin_log10(val: f64) callconv(.Inline) f64 {
+    return @log10(val);
+}
+pub fn __builtin_log10f(val: f32) callconv(.Inline) f32 {
+    return @log10(val);
+}
 
 // Standard C Library bug: The absolute value of the most negative integer remains negative.
-pub fn __builtin_abs(val: c_int) callconv(.Inline) c_int { return std.math.absInt(val) catch std.math.minInt(c_int); }
-pub fn __builtin_fabs(val: f64) callconv(.Inline) f64 { return @fabs(val); }
-pub fn __builtin_fabsf(val: f32) callconv(.Inline) f32 { return @fabs(val); }
-
-pub fn __builtin_floor(val: f64) callconv(.Inline) f64 { return @floor(val); }
-pub fn __builtin_floorf(val: f32) callconv(.Inline) f32 { return @floor(val); }
-pub fn __builtin_ceil(val: f64) callconv(.Inline) f64 { return @ceil(val); }
-pub fn __builtin_ceilf(val: f32) callconv(.Inline) f32 { return @ceil(val); }
-pub fn __builtin_trunc(val: f64) callconv(.Inline) f64 { return @trunc(val); }
-pub fn __builtin_truncf(val: f32) callconv(.Inline) f32 { return @trunc(val); }
-pub fn __builtin_round(val: f64) callconv(.Inline) f64 { return @round(val); }
-pub fn __builtin_roundf(val: f32) callconv(.Inline) f32 { return @round(val); }
-
-pub fn __builtin_strlen(s: [*c]const u8) callconv(.Inline) usize { return std.mem.lenZ(s); }
+pub fn __builtin_abs(val: c_int) callconv(.Inline) c_int {
+    return std.math.absInt(val) catch std.math.minInt(c_int);
+}
+pub fn __builtin_fabs(val: f64) callconv(.Inline) f64 {
+    return @fabs(val);
+}
+pub fn __builtin_fabsf(val: f32) callconv(.Inline) f32 {
+    return @fabs(val);
+}
+
+pub fn __builtin_floor(val: f64) callconv(.Inline) f64 {
+    return @floor(val);
+}
+pub fn __builtin_floorf(val: f32) callconv(.Inline) f32 {
+    return @floor(val);
+}
+pub fn __builtin_ceil(val: f64) callconv(.Inline) f64 {
+    return @ceil(val);
+}
+pub fn __builtin_ceilf(val: f32) callconv(.Inline) f32 {
+    return @ceil(val);
+}
+pub fn __builtin_trunc(val: f64) callconv(.Inline) f64 {
+    return @trunc(val);
+}
+pub fn __builtin_truncf(val: f32) callconv(.Inline) f32 {
+    return @trunc(val);
+}
+pub fn __builtin_round(val: f64) callconv(.Inline) f64 {
+    return @round(val);
+}
+pub fn __builtin_roundf(val: f32) callconv(.Inline) f32 {
+    return @round(val);
+}
+
+pub fn __builtin_strlen(s: [*c]const u8) callconv(.Inline) usize {
+    return std.mem.lenZ(s);
+}
 pub fn __builtin_strcmp(s1: [*c]const u8, s2: [*c]const u8) callconv(.Inline) c_int {
     return @as(c_int, std.cstr.cmp(s1, s2));
 }
lib/std/c/parse.zig
@@ -300,8 +300,7 @@ const Parser = struct {
                     try node.initializers.push((try parser.initializer(dr)) orelse return parser.err(.{
                         .ExpectedInitializer = .{ .token = parser.it.index },
                     }));
-                } else
-                    try node.initializers.push(&dr.base);
+                } else try node.initializers.push(&dr.base);
                 if (parser.eatToken(.Comma) != null) break;
                 dr = @fieldParentPtr(Node.Declarator, "base", (try parser.declarator(.Must)) orelse return parser.err(.{
                     .ExpectedDeclarator = .{ .token = parser.it.index },
lib/std/crypto/aegis.zig
@@ -81,8 +81,8 @@ const State128L = struct {
         while (i < 7) : (i += 1) {
             state.update(tmp, tmp);
         }
-        return blocks[0].xorBlocks(blocks[1]).xorBlocks(blocks[2]).xorBlocks(blocks[3]).xorBlocks(blocks[4]).
-            xorBlocks(blocks[5]).xorBlocks(blocks[6]).toBytes();
+        return blocks[0].xorBlocks(blocks[1]).xorBlocks(blocks[2]).xorBlocks(blocks[3]).xorBlocks(blocks[4])
+            .xorBlocks(blocks[5]).xorBlocks(blocks[6]).toBytes();
     }
 };
 
@@ -244,8 +244,8 @@ const State256 = struct {
         while (i < 7) : (i += 1) {
             state.update(tmp);
         }
-        return blocks[0].xorBlocks(blocks[1]).xorBlocks(blocks[2]).xorBlocks(blocks[3]).xorBlocks(blocks[4]).
-            xorBlocks(blocks[5]).toBytes();
+        return blocks[0].xorBlocks(blocks[1]).xorBlocks(blocks[2]).xorBlocks(blocks[3]).xorBlocks(blocks[4])
+            .xorBlocks(blocks[5]).toBytes();
     }
 };
 
lib/std/crypto/bcrypt.zig
@@ -109,9 +109,7 @@ const State = struct {
         }
     }
 
-    const Halves = struct {
-        l: u32, r: u32
-    };
+    const Halves = struct { l: u32, r: u32 };
 
     fn feistelF(state: State, x: u32) u32 {
         var r = state.sboxes[0][@truncate(u8, x >> 24)];
lib/std/event/batch.zig
@@ -98,15 +98,16 @@ pub fn Batch(
         /// This function is *not* thread-safe. It must be called from one thread at
         /// a time, however, it need not be the same thread.
         pub fn wait(self: *Self) CollectedResult {
-            for (self.jobs) |*job| if (job.frame) |f| {
-                job.result = if (async_ok) await f else nosuspend await f;
-                if (CollectedResult != void) {
-                    job.result catch |err| {
-                        self.collected_result = err;
-                    };
-                }
-                job.frame = null;
-            };
+            for (self.jobs) |*job|
+                if (job.frame) |f| {
+                    job.result = if (async_ok) await f else nosuspend await f;
+                    if (CollectedResult != void) {
+                        job.result catch |err| {
+                            self.collected_result = err;
+                        };
+                    }
+                    job.frame = null;
+                };
             return self.collected_result;
         }
     };
lib/std/meta/trait.zig
@@ -544,15 +544,11 @@ test "std.meta.trait.hasUniqueRepresentation" {
 
     testing.expect(hasUniqueRepresentation(TestStruct3));
 
-    const TestStruct4 = struct {
-        a: []const u8
-    };
+    const TestStruct4 = struct { a: []const u8 };
 
     testing.expect(!hasUniqueRepresentation(TestStruct4));
 
-    const TestStruct5 = struct {
-        a: TestStruct4
-    };
+    const TestStruct5 = struct { a: TestStruct4 };
 
     testing.expect(!hasUniqueRepresentation(TestStruct5));
 
lib/std/os/bits/netbsd.zig
@@ -836,13 +836,15 @@ pub const ucontext_t = extern struct {
     sigmask: sigset_t,
     stack: stack_t,
     mcontext: mcontext_t,
-    __pad: [switch (builtin.arch) {
-        .i386 => 4,
-        .mips, .mipsel, .mips64, .mips64el => 14,
-        .arm, .armeb, .thumb, .thumbeb => 1,
-        .sparc, .sparcel, .sparcv9 => if (@sizeOf(usize) == 4) 43 else 8,
-        else => 0,
-    }]u32,
+    __pad: [
+        switch (builtin.arch) {
+            .i386 => 4,
+            .mips, .mipsel, .mips64, .mips64el => 14,
+            .arm, .armeb, .thumb, .thumbeb => 1,
+            .sparc, .sparcel, .sparcv9 => if (@sizeOf(usize) == 4) 43 else 8,
+            else => 0,
+        }
+    ]u32,
 };
 
 pub const EPERM = 1; // Operation not permitted
lib/std/os/windows/bits.zig
@@ -1315,11 +1315,13 @@ pub const PEB = extern struct {
     ImageSubSystemMinorVersion: ULONG,
     // note: there is padding here on 64 bit
     ActiveProcessAffinityMask: KAFFINITY,
-    GdiHandleBuffer: [switch (@sizeOf(usize)) {
-        4 => 0x22,
-        8 => 0x3C,
-        else => unreachable,
-    }]ULONG,
+    GdiHandleBuffer: [
+        switch (@sizeOf(usize)) {
+            4 => 0x22,
+            8 => 0x3C,
+            else => unreachable,
+        }
+    ]ULONG,
 
     // Fields appended in 5.0 (Windows 2000):
     PostProcessInitRoutine: PVOID,
lib/std/special/compiler_rt/arm.zig
@@ -66,10 +66,7 @@ pub fn __aeabi_uidivmod() callconv(.Naked) void {
         \\ ldr r1, [sp]
         \\ add sp, #4
         \\ pop {pc}
-        :
-        :
-        : "memory"
-    );
+        ::: "memory");
     unreachable;
 }
 
@@ -86,10 +83,7 @@ pub fn __aeabi_uldivmod() callconv(.Naked) void {
         \\ ldr r3, [sp, #12]
         \\ add sp, #16
         \\ pop {r4, pc}
-        :
-        :
-        : "memory"
-    );
+        ::: "memory");
     unreachable;
 }
 
@@ -104,10 +98,7 @@ pub fn __aeabi_idivmod() callconv(.Naked) void {
         \\ ldr r1, [sp]
         \\ add sp, #4
         \\ pop {pc}
-        :
-        :
-        : "memory"
-    );
+        ::: "memory");
     unreachable;
 }
 
@@ -124,9 +115,6 @@ pub fn __aeabi_ldivmod() callconv(.Naked) void {
         \\ ldr r3, [sp, #12]
         \\ add sp, #16
         \\ pop {r4, pc}
-        :
-        :
-        : "memory"
-    );
+        ::: "memory");
     unreachable;
 }
lib/std/Thread/Semaphore.zig
@@ -10,7 +10,7 @@
 
 mutex: Mutex = .{},
 cond: Condition = .{},
-//! It is OK to initialize this field to any value.
+/// It is OK to initialize this field to any value.
 permits: usize = 0,
 
 const Semaphore = @This();
lib/std/array_hash_map.zig
@@ -1237,8 +1237,7 @@ test "shrink" {
         if (i < 17) {
             testing.expect(gop.found_existing == true);
             testing.expect(gop.entry.value == i * 10);
-        } else
-            testing.expect(gop.found_existing == false);
+        } else testing.expect(gop.found_existing == false);
     }
 
     // Test `shrinkAndFree`.
@@ -1251,8 +1250,7 @@ test "shrink" {
         if (i < 15) {
             testing.expect(gop.found_existing == true);
             testing.expect(gop.entry.value == i * 10);
-        } else
-            testing.expect(gop.found_existing == false);
+        } else testing.expect(gop.found_existing == false);
     }
 }
 
lib/std/base64.zig
@@ -222,12 +222,10 @@ pub const Base64DecoderWithIgnore = struct {
                         } else if (decoder_with_ignore.char_is_ignored[c]) {
                             // we can even ignore chars during the padding
                             continue;
-                        } else
-                            return error.InvalidCharacter;
+                        } else return error.InvalidCharacter;
                     }
                     break;
-                } else
-                    return error.InvalidCharacter;
+                } else return error.InvalidCharacter;
             }
 
             switch (available_chars) {
lib/std/build.zig
@@ -2763,7 +2763,9 @@ pub const InstallDirectoryOptions = struct {
             .install_dir = self.install_dir.dupe(b),
             .install_subdir = b.dupe(self.install_subdir),
             .exclude_extensions = if (self.exclude_extensions) |extensions|
-                b.dupeStrings(extensions) else null,
+                b.dupeStrings(extensions)
+            else
+                null,
         };
     }
 };
lib/std/coff.zig
@@ -173,8 +173,7 @@ pub const Coff = struct {
             skip_size = 2 * @sizeOf(u8) + 8 * @sizeOf(u16) + 18 * @sizeOf(u32);
         } else if (self.pe_header.magic == IMAGE_NT_OPTIONAL_HDR64_MAGIC) {
             skip_size = 2 * @sizeOf(u8) + 8 * @sizeOf(u16) + 12 * @sizeOf(u32) + 5 * @sizeOf(u64);
-        } else
-            return error.InvalidPEMagic;
+        } else return error.InvalidPEMagic;
 
         try self.in_file.seekBy(skip_size);
 
lib/std/dwarf.zig
@@ -213,13 +213,11 @@ const LineNumberProgram = struct {
                 return error.MissingDebugInfo;
             } else if (self.prev_file - 1 >= self.file_entries.items.len) {
                 return error.InvalidDebugInfo;
-            } else
-                &self.file_entries.items[self.prev_file - 1];
+            } else &self.file_entries.items[self.prev_file - 1];
 
             const dir_name = if (file_entry.dir_index >= self.include_dirs.len) {
                 return error.InvalidDebugInfo;
-            } else
-                self.include_dirs[file_entry.dir_index];
+            } else self.include_dirs[file_entry.dir_index];
             const file_name = try fs.path.join(self.file_entries.allocator, &[_][]const u8{ dir_name, file_entry.file_name });
             errdefer self.file_entries.allocator.free(file_name);
             return debug.LineInfo{
lib/std/fmt.zig
@@ -646,8 +646,7 @@ pub fn formatIntValue(
     const int_value = if (@TypeOf(value) == comptime_int) blk: {
         const Int = math.IntFittingRange(value, value);
         break :blk @as(Int, value);
-    } else
-        value;
+    } else value;
 
     if (fmt.len == 0 or comptime std.mem.eql(u8, fmt, "d")) {
         radix = 10;
@@ -1087,8 +1086,7 @@ pub fn formatInt(
     const int_value = if (@TypeOf(value) == comptime_int) blk: {
         const Int = math.IntFittingRange(value, value);
         break :blk @as(Int, value);
-    } else
-        value;
+    } else value;
 
     const value_info = @typeInfo(@TypeOf(int_value)).Int;
 
lib/std/log.zig
@@ -3,9 +3,6 @@
 // This file is part of [zig](https://ziglang.org/), which is MIT licensed.
 // The MIT license requires this copyright notice to be included in all copies
 // and substantial portions of the software.
-const std = @import("std.zig");
-const builtin = std.builtin;
-const root = @import("root");
 
 //! std.log is a standardized interface for logging which allows for the logging
 //! of programs and libraries using this interface to be formatted and filtered
@@ -77,6 +74,10 @@ const root = @import("root");
 //! [err] (nice_library): Something went very wrong, sorry
 //! ```
 
+const std = @import("std.zig");
+const builtin = std.builtin;
+const root = @import("root");
+
 pub const Level = enum {
     /// Emergency: a condition that cannot be handled, usually followed by a
     /// panic.
lib/std/meta.zig
@@ -534,9 +534,7 @@ pub fn fieldNames(comptime T: type) *const [fields(T).len][]const u8 {
 }
 
 test "std.meta.fieldNames" {
-    const E1 = enum {
-        A, B
-    };
+    const E1 = enum { A, B };
     const E2 = error{A};
     const S1 = struct {
         a: u8,
@@ -1002,19 +1000,19 @@ pub fn sizeof(target: anytype) usize {
                 // Note: sizeof(void) is 1 on clang/gcc and 0 on MSVC.
                 return 1;
             } else {
-                @compileError("Cannot use C sizeof on opaque type "++@typeName(T));
+                @compileError("Cannot use C sizeof on opaque type " ++ @typeName(T));
             }
         },
         .Optional => |opt| {
             if (@typeInfo(opt.child) == .Pointer) {
                 return sizeof(opt.child);
             } else {
-                @compileError("Cannot use C sizeof on non-pointer optional "++@typeName(T));
+                @compileError("Cannot use C sizeof on non-pointer optional " ++ @typeName(T));
             }
         },
         .Pointer => |ptr| {
             if (ptr.size == .Slice) {
-                @compileError("Cannot use C sizeof on slice type "++@typeName(T));
+                @compileError("Cannot use C sizeof on slice type " ++ @typeName(T));
             }
             // for strings, sizeof("a") returns 2.
             // normal pointer decay scenarios from C are handled
@@ -1024,8 +1022,9 @@ pub fn sizeof(target: anytype) usize {
             if (ptr.size == .One and ptr.is_const and @typeInfo(ptr.child) == .Array) {
                 const array_info = @typeInfo(ptr.child).Array;
                 if ((array_info.child == u8 or array_info.child == u16) and
-                     array_info.sentinel != null and
-                     array_info.sentinel.? == 0) {
+                    array_info.sentinel != null and
+                    array_info.sentinel.? == 0)
+                {
                     // length of the string plus one for the null terminator.
                     return (array_info.len + 1) * @sizeOf(array_info.child);
                 }
@@ -1067,10 +1066,10 @@ test "sizeof" {
 
     testing.expect(sizeof(S) == 4);
 
-    testing.expect(sizeof([_]u32{4, 5, 6}) == 12);
+    testing.expect(sizeof([_]u32{ 4, 5, 6 }) == 12);
     testing.expect(sizeof([3]u32) == 12);
     testing.expect(sizeof([3:0]u32) == 16);
-    testing.expect(sizeof(&[_]u32{4, 5, 6}) == ptr_size);
+    testing.expect(sizeof(&[_]u32{ 4, 5, 6 }) == ptr_size);
 
     testing.expect(sizeof(*u32) == ptr_size);
     testing.expect(sizeof([*]u32) == ptr_size);
@@ -1082,7 +1081,7 @@ test "sizeof" {
     testing.expect(sizeof(null) == ptr_size);
 
     testing.expect(sizeof("foobar") == 7);
-    testing.expect(sizeof(&[_:0]u16{'f','o','o','b','a','r'}) == 14);
+    testing.expect(sizeof(&[_:0]u16{ 'f', 'o', 'o', 'b', 'a', 'r' }) == 14);
     testing.expect(sizeof(*const [4:0]u8) == 5);
     testing.expect(sizeof(*[4:0]u8) == ptr_size);
     testing.expect(sizeof([*]const [4:0]u8) == ptr_size);
lib/std/os.zig
@@ -3263,8 +3263,9 @@ pub fn connect(sock: socket_t, sock_addr: *const sockaddr, len: socklen_t) Conne
             .WSAEADDRNOTAVAIL => return error.AddressNotAvailable,
             .WSAECONNREFUSED => return error.ConnectionRefused,
             .WSAETIMEDOUT => return error.ConnectionTimedOut,
-            .WSAEHOSTUNREACH // TODO: should we return NetworkUnreachable in this case as well?
-            , .WSAENETUNREACH => return error.NetworkUnreachable,
+            .WSAEHOSTUNREACH, // TODO: should we return NetworkUnreachable in this case as well?
+            .WSAENETUNREACH,
+            => return error.NetworkUnreachable,
             .WSAEFAULT => unreachable,
             .WSAEINVAL => unreachable,
             .WSAEISCONN => unreachable,
lib/std/Thread.zig
@@ -70,16 +70,8 @@ else switch (std.Target.current.os.tag) {
 /// Signals the processor that it is inside a busy-wait spin-loop ("spin lock").
 pub fn spinLoopHint() void {
     switch (std.Target.current.cpu.arch) {
-        .i386, .x86_64 => asm volatile ("pause"
-            :
-            :
-            : "memory"
-        ),
-        .arm, .aarch64 => asm volatile ("yield"
-            :
-            :
-            : "memory"
-        ),
+        .i386, .x86_64 => asm volatile ("pause" ::: "memory"),
+        .arm, .aarch64 => asm volatile ("yield" ::: "memory"),
         else => {},
     }
 }
@@ -90,12 +82,11 @@ pub fn spinLoopHint() void {
 pub fn getCurrentId() Id {
     if (use_pthreads) {
         return c.pthread_self();
-    } else
-        return switch (std.Target.current.os.tag) {
-            .linux => os.linux.gettid(),
-            .windows => windows.kernel32.GetCurrentThreadId(),
-            else => @compileError("Unsupported OS"),
-        };
+    } else return switch (std.Target.current.os.tag) {
+        .linux => os.linux.gettid(),
+        .windows => windows.kernel32.GetCurrentThreadId(),
+        else => @compileError("Unsupported OS"),
+    };
 }
 
 /// Returns the handle of this thread.