diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2017-12-22 00:50:30 -0500 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2017-12-22 00:50:30 -0500 |
| commit | d917815d8111b98dc237cbe2c723fa63018e02b1 (patch) | |
| tree | ce12771a86b2412ee9692ca73d3ca49abe5da3ce /std/io.zig | |
| parent | 8bc523219c66427951e5339550502871547f2138 (diff) | |
| download | zig-d917815d8111b98dc237cbe2c723fa63018e02b1.tar.gz zig-d917815d8111b98dc237cbe2c723fa63018e02b1.zip | |
explicitly return from blocks
instead of last statement being expression value
closes #629
Diffstat (limited to 'std/io.zig')
| -rw-r--r-- | std/io.zig | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/std/io.zig b/std/io.zig index 0ba3d06a01..cbf2e0c216 100644 --- a/std/io.zig +++ b/std/io.zig @@ -50,35 +50,32 @@ error Unseekable; error EndOfFile; pub fn getStdErr() -> %File { - const handle = if (is_windows) { + const handle = if (is_windows) %return os.windowsGetStdHandle(system.STD_ERROR_HANDLE) - } else if (is_posix) { + else if (is_posix) system.STDERR_FILENO - } else { - unreachable - }; + else + unreachable; return File.openHandle(handle); } pub fn getStdOut() -> %File { - const handle = if (is_windows) { + const handle = if (is_windows) %return os.windowsGetStdHandle(system.STD_OUTPUT_HANDLE) - } else if (is_posix) { + else if (is_posix) system.STDOUT_FILENO - } else { - unreachable - }; + else + unreachable; return File.openHandle(handle); } pub fn getStdIn() -> %File { - const handle = if (is_windows) { + const handle = if (is_windows) %return os.windowsGetStdHandle(system.STD_INPUT_HANDLE) - } else if (is_posix) { + else if (is_posix) system.STDIN_FILENO - } else { - unreachable - }; + else + unreachable; return File.openHandle(handle); } @@ -261,7 +258,7 @@ pub const File = struct { system.EBADF => error.BadFd, system.ENOMEM => error.SystemResources, else => os.unexpectedErrorPosix(err), - } + }; } return usize(stat.size); |
