diff --git a/src/lang.zig b/src/lang.zig index 4db0cb7..73ece6a 100644 --- a/src/lang.zig +++ b/src/lang.zig @@ -500,13 +500,10 @@ pub const Lang = struct { } const arg = maybe_arg.?; + if (cmd_field.field_type != f32) + @compileError("LV2 parameter struct can only have f32 fields"); - const argument_value = switch (cmd_field.field_type) { - f32 => try std.fmt.parseFloat(f32, arg), - else => @compileError("LV2 parameter struct can only have f32 fields"), - }; - - @field(cmd.parameters, cmd_field.name) = argument_value; + @field(cmd.parameters, cmd_field.name) = try std.fmt.parseFloat(f32, arg); } } else { inline for (@typeInfo(command_struct).Struct.fields) |cmd_field| {