gtk: use unreachable in switch statements

This commit is contained in:
Thorsten Ball
2023-10-20 12:31:06 +02:00
committed by Mitchell Hashimoto
parent 8afcce666a
commit a50fc7bc50

View File

@ -255,6 +255,7 @@ pub fn closeSurface(self: *Window, surface: *Surface) void {
const alloc = surface.app.core_app.alloc; const alloc = surface.app.core_app.alloc;
switch (surface.parent) { switch (surface.parent) {
.none => unreachable,
.tab => |tab| self.closeTab(tab), .tab => |tab| self.closeTab(tab),
.paned => |paned_tuple| { .paned => |paned_tuple| {
const paned = paned_tuple[0]; const paned = paned_tuple[0];
@ -294,6 +295,7 @@ pub fn closeSurface(self: *Window, surface: *Surface) void {
defer alloc.destroy(paned); defer alloc.destroy(paned);
switch (paned.parent) { switch (paned.parent) {
.none => unreachable,
.tab => |tab| { .tab => |tab| {
// If parent of Paned we belong to is a tab, we can // If parent of Paned we belong to is a tab, we can
// replace the child with the other surface // replace the child with the other surface
@ -303,14 +305,8 @@ pub fn closeSurface(self: *Window, surface: *Surface) void {
.paned => |paned_paned| { .paned => |paned_paned| {
log.info("paned is nested, parent is paned. position={}", .{paned_paned[1]}); log.info("paned is nested, parent is paned. position={}", .{paned_paned[1]});
}, },
.none => {
log.info("paned has no parent", .{});
},
} }
}, },
.none => {
log.info("no parent, dude?!", .{});
},
} }
} }