Commit 9f0821e688

Lachlan Easton <lachlan@lakebythewoods.xyz>
2020-08-30 07:02:05
zig fmt: Fix erroneously commented out code, add passing test case to close #5722
1 parent ea6181a
Changed files (2)
lib/std/zig/parser_test.zig
@@ -3429,6 +3429,21 @@ test "zig fmt: Control flow statement as body of blockless if" {
     );
 }
 
+test "zig fmt: " {
+    try testCanonical(
+        \\pub fn sendViewTags(self: Self) void {
+        \\    var it = ViewStack(View).iterator(self.output.views.first, std.math.maxInt(u32));
+        \\    while (it.next()) |node|
+        \\        view_tags.append(node.view.current_tags) catch {
+        \\            c.wl_resource_post_no_memory(self.wl_resource);
+        \\            log.crit(.river_status, "out of memory", .{});
+        \\            return;
+        \\        };
+        \\}
+        \\
+    );
+}
+
 const std = @import("std");
 const mem = std.mem;
 const warn = std.debug.warn;
lib/std/zig/render.zig
@@ -1762,7 +1762,7 @@ fn renderExpression(
             }
 
             if (while_node.payload) |payload| {
-                const payload_space = Space.Space; //if (while_node.continue_expr != null) Space.Space else block_start_space;
+                const payload_space = if (while_node.continue_expr != null) Space.Space else block_start_space;
                 try renderExpression(allocator, ais, tree, payload, payload_space);
             }