def unused
bend-lint-rules@0.2.0.0 · no_unused/imports.bend:20
import bend-lint-rules@0.2.0.0/no_unused/imports.bend as Imports
import Base
import bend-lint-api@0.2.0.0/linter/lint.bend as Lint
20def unused(text: String, d: Lint.Declaration) -> List<&2, Lint.Finding>:
21 match d:
22 case Lint.Declaration{
23 Lint.Node{Lint.Import{t}, name, Some{Lint.Span{+path, +beg, end}}, k, f},
24 Nil{}
25 }:
26 [
27 Lint.Finding{
28 Lint.Warning{},
29 Lint.Span{path, beg, end},
30 "Remove the import " ++ name ++ ": nothing uses it.",
31 deleted(text, path, beg)
32 }
33 ]
34 case _:
35 []