From 6470d8c776343fed30032ad96f75f7d78aac0a18 Mon Sep 17 00:00:00 2001 From: Isaac Freund Date: Sun, 14 Feb 2021 18:13:15 +0100 Subject: [PATCH] command: silently ignore re-declaring a mode This change is made in the interest of allowing users to simply re-run their init script at runtime without errors. Making this an error doesn't really gain us anything. --- river/command/declare_mode.zig | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/river/command/declare_mode.zig b/river/command/declare_mode.zig index a5ba771..36634aa 100644 --- a/river/command/declare_mode.zig +++ b/river/command/declare_mode.zig @@ -37,14 +37,7 @@ pub fn declareMode( const config = &seat.input_manager.server.config; const new_mode_name = args[1]; - if (config.mode_to_id.get(new_mode_name) != null) { - out.* = try std.fmt.allocPrint( - allocator, - "mode '{}' already exists and cannot be re-declared", - .{new_mode_name}, - ); - return Error.Other; - } + if (config.mode_to_id.get(new_mode_name) != null) return; try config.modes.ensureCapacity(config.modes.items.len + 1); const owned_name = try std.mem.dupe(util.gpa, u8, new_mode_name);