Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

T08 Adopt the lint table

Question

Cerebro’s [workspace.lints.clippy] is only pedantic = "warn". Adopt the standard’s lints.md table (levels deny/forbid, never warn):

  • rustc denies: warnings, missing_docs, unreachable_pub, missing_debug_implementations, elided_lifetimes_in_paths, single_use_lifetimes, unused_crate_dependencies; forbid unsafe_code deferred to T12 (the 14 test unsafe blocks).
  • clippy: pedantic and nursery denied as groups with priority = -1.
  • the four workspace reasoned-allows: module_name_repetitions, must_use_candidate, doc_markdown, redundant_pub_crate.

Land in dependency order (cheapest first) so each commit is green. Panic classes (T09/T10) and missing_docs (T11) are separate tickets.

Exit predicate

cargo clippy --workspace --all-targets passes with the deny table in place and no new #[allow] beyond the four reasoned allows + any T07-justified nursery allow. AGENTS.md’s “pedantic lints are warnings” line is corrected (see T17).

Resolution

Done 2026-10-31. [workspace.lints] now carries the standard’s table: rustc denies (warnings, unreachable_pub, missing_debug_implementations, elided_lifetimes_in_paths, single_use_lifetimes, unused_crate_dependencies) and clippy pedantic + nursery denied as groups at priority = -1 with the four reasoned allows. Two exclusions by plan: missing_docs waits for T11 and unsafe_code joins as forbid only with T12 (ADR-0017); the manifest comments record both.

Finding count reality check. T07’s “15 findings, all in core” undercounted because cerebro-core’s own failure stopped clippy from ever linting the dependent crates. True initial volume was roughly 250 across the workspace, of which 136 were macro-generated trivial_regex in tests/cucumber.rs.

Mechanical groups (lifetimes, const, Debug derives, or_fun_call, unreachable_pub, redundant clones) were applied from compiler suggestions via a one-off rustfix script plus targeted edits. Semantic groups (if let/else to map_or/is_some_and, early drop() for async mutex guards) were hand-reviewed; the workspace test suite, doctests, and the cucumber BDD binary all pass, which is the behaviour-preservation evidence.

Structural additions the table forced: Component now requires Send + Debug, HandleRequest gains Debug, and the core Storage/Git/ Database traits gained a Debug supertrait so Arc<dyn _> fields stay printable. All implementors and test mocks derive it.

One deviation from the exit predicate, flagged for review: a single scoped #![allow(clippy::trivial_regex, reason = "cucumber macro-generated step regexes")] in tests/cucumber.rs. The 136 findings have no call site (the #[given]/#[when]/#[then] attributes compile every step string into a Regex), so no fix exists; the allow is test-scoped, carries its reason, and is visible to review, per the standard’s own scoped-allow rule.

Gate: cargo clippy --workspace --all-targets clean with zero -D flags needed (the manifest IS the gate now), just quality green, and cerebro build --project cerebro runs the rewritten generators.