mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
fmt: hide ´[]Type{} instead of []Type´ and ´(f mut Foo)´ warnings (#8528)
This commit is contained in:
@ -94,8 +94,10 @@ fn (mut p Parser) array_init() ast.ArrayInit {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if exprs.len == 0 && p.tok.kind != .lcbr && has_type {
|
if exprs.len == 0 && p.tok.kind != .lcbr && has_type {
|
||||||
|
if !p.pref.is_fmt {
|
||||||
p.warn_with_pos('use `x := []Type{}` instead of `x := []Type`', first_pos.extend(last_pos))
|
p.warn_with_pos('use `x := []Type{}` instead of `x := []Type`', first_pos.extend(last_pos))
|
||||||
}
|
}
|
||||||
|
}
|
||||||
mut has_len := false
|
mut has_len := false
|
||||||
mut has_cap := false
|
mut has_cap := false
|
||||||
mut len_expr := ast.Expr{}
|
mut len_expr := ast.Expr{}
|
||||||
|
@ -665,7 +665,9 @@ fn (mut p Parser) fn_args() ([]table.Param, bool, bool) {
|
|||||||
}
|
}
|
||||||
if p.tok.kind == .key_mut {
|
if p.tok.kind == .key_mut {
|
||||||
// TODO remove old syntax
|
// TODO remove old syntax
|
||||||
|
if !p.pref.is_fmt {
|
||||||
p.warn_with_pos('use `mut f Foo` instead of `f mut Foo`', p.tok.position())
|
p.warn_with_pos('use `mut f Foo` instead of `f mut Foo`', p.tok.position())
|
||||||
|
}
|
||||||
is_mut = true
|
is_mut = true
|
||||||
}
|
}
|
||||||
if p.tok.kind == .ellipsis {
|
if p.tok.kind == .ellipsis {
|
||||||
|
Reference in New Issue
Block a user