From ea06966fd45b003a0962e0beb094b575a6284a88 Mon Sep 17 00:00:00 2001 From: Lukas Neubert <serkonda@protonmail.com> Date: Wed, 3 Feb 2021 10:25:08 +0100 Subject: [PATCH] =?UTF-8?q?fmt:=20hide=20=C2=B4[]Type{}=20instead=20of=20[?= =?UTF-8?q?]Type=C2=B4=20and=20=C2=B4(f=20mut=20Foo)=C2=B4=20warnings=20(#?= =?UTF-8?q?8528)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vlib/v/parser/containers.v | 4 +++- vlib/v/parser/fn.v | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/vlib/v/parser/containers.v b/vlib/v/parser/containers.v index 92778ab254..9dddfb60b6 100644 --- a/vlib/v/parser/containers.v +++ b/vlib/v/parser/containers.v @@ -94,7 +94,9 @@ fn (mut p Parser) array_init() ast.ArrayInit { } } if exprs.len == 0 && p.tok.kind != .lcbr && has_type { - p.warn_with_pos('use `x := []Type{}` instead of `x := []Type`', first_pos.extend(last_pos)) + if !p.pref.is_fmt { + p.warn_with_pos('use `x := []Type{}` instead of `x := []Type`', first_pos.extend(last_pos)) + } } mut has_len := false mut has_cap := false diff --git a/vlib/v/parser/fn.v b/vlib/v/parser/fn.v index df1b06a1e1..197f929d82 100644 --- a/vlib/v/parser/fn.v +++ b/vlib/v/parser/fn.v @@ -665,7 +665,9 @@ fn (mut p Parser) fn_args() ([]table.Param, bool, bool) { } if p.tok.kind == .key_mut { // TODO remove old syntax - p.warn_with_pos('use `mut f Foo` instead of `f mut Foo`', p.tok.position()) + if !p.pref.is_fmt { + p.warn_with_pos('use `mut f Foo` instead of `f mut Foo`', p.tok.position()) + } is_mut = true } if p.tok.kind == .ellipsis {