From c6f98afaba04ae3c17ba1b942fc6dc74f459a6d3 Mon Sep 17 00:00:00 2001 From: Lukas Neubert Date: Mon, 25 Jan 2021 23:22:14 +0100 Subject: [PATCH] fmt: minor cleanup of return_stmt (#8341) --- vlib/v/fmt/fmt.v | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/vlib/v/fmt/fmt.v b/vlib/v/fmt/fmt.v index cd2df87efe..b77d8c0974 100644 --- a/vlib/v/fmt/fmt.v +++ b/vlib/v/fmt/fmt.v @@ -2335,19 +2335,15 @@ pub fn (mut f Fmt) go_stmt(node ast.GoStmt, is_expr bool) { pub fn (mut f Fmt) return_stmt(node ast.Return) { f.comments(node.comments, {}) f.write('return') - if node.exprs.len > 1 { - // multiple returns + if node.exprs.len > 0 { f.write(' ') + // Loop over all return values. In normal returns this will only run once. for i, expr in node.exprs { f.expr(expr) if i < node.exprs.len - 1 { f.write(', ') } } - } else if node.exprs.len == 1 { - // normal return - f.write(' ') - f.expr(node.exprs[0]) } f.writeln('') }