glfw: enum-ify 'Joystick.jid', set 'InvalidEnum' as unreachable, and run zig fmt

This commit is contained in:
InKryption 2021-11-22 19:54:36 +01:00 committed by Stephen Gutekanst
parent aae3ea8577
commit 88e0d37325
4 changed files with 68 additions and 79 deletions

View file

@ -85,7 +85,7 @@ pub inline fn createStandard(shape: Shape) Error!Cursor {
const cursor = c.glfwCreateStandardCursor(@intCast(c_int, @enumToInt(shape)));
getError() catch |err| return switch (err) {
// should be unreachable given that only the values in 'Shape' are available, unless the user explicitly gives us a bad value via casting
Error.InvalidEnum => unreachable,
Error.InvalidEnum => unreachable,
Error.PlatformError => err,
else => unreachable,
};
@ -111,7 +111,7 @@ pub inline fn destroy(self: Cursor) void {
internal_debug.assertInitialized();
c.glfwDestroyCursor(self.ptr);
getError() catch |err| return switch (err) {
Error.PlatformError => std.log.debug("{}: was unable to destroy Cursor.\n", .{ err }),
Error.PlatformError => std.log.debug("{}: was unable to destroy Cursor.\n", .{err}),
else => unreachable,
};
}