fmt: hide ´[]Type{} instead of []Type´ and ´(f mut Foo)´ warnings (#8528)
parent
49a6f9fb39
commit
ea06966fd4
|
@ -94,7 +94,9 @@ 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 {
|
||||||
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_len := false
|
||||||
mut has_cap := false
|
mut has_cap := false
|
||||||
|
|
|
@ -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
|
||||||
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
|
is_mut = true
|
||||||
}
|
}
|
||||||
if p.tok.kind == .ellipsis {
|
if p.tok.kind == .ellipsis {
|
||||||
|
|
Loading…
Reference in New Issue