From d60ce203059f75f9eca6fe0c021ba77de0ad8a34 Mon Sep 17 00:00:00 2001 From: Simon Hartcher Date: Thu, 5 Jun 2025 11:05:54 +1000 Subject: [PATCH] refactor: simplify switches using inline --- codegen/src/smithy_tools.zig | 28 +++------------------------- 1 file changed, 3 insertions(+), 25 deletions(-) diff --git a/codegen/src/smithy_tools.zig b/codegen/src/smithy_tools.zig index 6e5e31f..00b79d8 100644 --- a/codegen/src/smithy_tools.zig +++ b/codegen/src/smithy_tools.zig @@ -15,36 +15,14 @@ pub fn getShapeInfo(id: []const u8, shapes: std.StringHashMap(smithy.ShapeInfo)) pub fn getShapeTraits(shape: Shape) []smithy.Trait { return switch (shape) { - .@"enum" => |s| s.traits, - .bigDecimal, - .bigInteger, - .blob, - .boolean, - .byte, - .document, - .double, - .float, - .integer, - .long, - .member, - .short, - .string, - .timestamp, - .unit, - => |s| s.traits, - .list => |s| s.traits, - .map => |s| s.traits, - .set => |s| s.traits, - .structure => |s| s.traits, - .uniontype => |s| s.traits, - else => std.debug.panic("Unexpected shape type: {}", .{shape}), + .service, .operation, .resource => std.debug.panic("Unexpected shape type: {}", .{shape}), + inline else => |s| s.traits, }; } pub fn getShapeMembers(shape: Shape) []smithy.TypeMember { return switch (shape) { - .structure => |s| s.members, - .uniontype => |s| s.members, + inline .structure, .uniontype => |s| s.members, else => std.debug.panic("Unexpected shape type: {}", .{shape}), }; }