From 45a8c6c1f4efae49effdcecd541572872fa69582 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Sat, 15 Jul 2023 23:07:01 -0700 Subject: [PATCH] AstGen: idiomatic use of switch --- src/AstGen.zig | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/AstGen.zig b/src/AstGen.zig index 820531097c..1aa70d86a9 100644 --- a/src/AstGen.zig +++ b/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, + }, } }, }); }