def check.go
bolt@1.27.0.0 · src/rules/suspicious/unused.bend:235
import bolt@1.27.0.0/src/rules/suspicious/unused.bend as Unused
import Base
import bolt@1.27.0.0/src/lazy/lazy.bend as Lazy
import bolt@1.27.0.0/src/finding.bend as F
import bolt@1.27.0.0/src/syntax/bind.bend as Bind
235def check.go(
236 binds: List<&2, Bind.Bind>,
237 +hh: Hits,
238 +uses: List<&2, Bind.Use>,
239 +fl: List<&2, U32>,
240 +path: String
241) -> List<&2, F.Finding>:
242 match binds:
243 case Nil{}:
244 Nil{}
245 case Con{Bind.Bind{+name, +line, +col, +kind, note}, rest}:
246 +more = check.go(rest, hh, uses, fl, path)
247 +shown = reportable(kind, note, line, fl)
248 +hit = Bool.and(shown, Bool.not(String.starts_with(name, "_")))
249 Bool.pick(List<&2, F.Finding>, Lazy.and_then(hit, _u => Bool.not(seen(hh, uses, line, col))),
250 F.Finding{path, line, col, U32.from_nat(String.length(name)), "unused",
251 what(kind) ++ " " ++ name ++ " is never used."} <> more, more)