vfmt: turn off module is imported but never used for vfmt

pull/5801/head
Delyan Angelov 2020-07-11 15:03:17 +03:00
parent 7c0a298701
commit b55f84c0a8
2 changed files with 4 additions and 1 deletions

View File

@ -0,0 +1,3 @@
module proto
import emily33901.vproto

View File

@ -37,7 +37,7 @@ fn (mut p Parser) check_unused_imports() {
for import_m in p.ast_imports { for import_m in p.ast_imports {
alias := import_m.alias alias := import_m.alias
mod := import_m.mod mod := import_m.mod
if !p.is_used_import(alias) { if !p.is_used_import(alias) && !p.pref.is_fmt {
mod_alias := if alias == mod { alias } else { '$alias ($mod)' } mod_alias := if alias == mod { alias } else { '$alias ($mod)' }
p.warn_with_pos("module '$mod_alias' is imported but never used", import_m.pos) p.warn_with_pos("module '$mod_alias' is imported but never used", import_m.pos)
} }