Commit 45a8c6c1f4

Andrew Kelley <andrew@ziglang.org>
2023-07-16 08:07:01
AstGen: idiomatic use of switch
1 parent 6754d1a
Changed files (1)
src/AstGen.zig
@@ -12095,7 +12095,10 @@ const GenZir = struct {
         return gz.addAsIndex(.{
             .tag = .save_err_ret_index,
             .data = .{ .save_err_ret_index = .{
-                .operand = if (cond == .if_of_error_type) cond.if_of_error_type else .none,
+                .operand = switch (cond) {
+                    .if_of_error_type => |x| x,
+                    else => .none,
+                },
             } },
         });
     }