Skip to content

Adopt cargo clippy as a CI gate (#2096 follow-up) #2326

Description

@carlos-alm

Found while working on

#2096 (Rust codebase had drifted from cargo fmt/clippy conventions). That issue's cargo fmt half is fixed (one-time repo-wide reformat + cargo fmt --check CI gate). This issue tracks the remaining cargo clippy half.

Context

As of #2096's investigation, cargo clippy reports 98 warnings against crates/codegraph-core, and nothing in CI runs clippy today.

Unlike cargo fmt (a purely mechanical, semantics-preserving reformat — safe to apply repo-wide in one automated pass, which #2096 already did), clippy warnings often require actual judgment per-lint: some are genuine simplifications, some flag idiomatic-but-flagged patterns, and a few can be legitimate false positives worth an #[allow(...)] with a comment rather than a code change. Blindly "fixing" all 98 in one pass risks introducing subtle behavior changes without adequate review, so it wasn't folded into #2096.

Suggested approach

  1. Run cargo clippy --workspace and triage the 98 warnings by lint category — likely a handful of #[allow]-worthy categories dominate the count rather than 98 independent issues.
  2. Fix (or explicitly allow with justification) each category, verifying behavior via cargo test after each batch — probably worth splitting into a few smaller PRs by category rather than one large diff, given the review burden the count implies.
  3. Add cargo clippy --workspace -- -D warnings (or a more targeted lint-level gate) to the existing rust-check CI job once the crate is clean, mirroring how Rust codebase has drifted from cargo fmt/clippy conventions (~1152 diff hunks, 98 warnings), not CI-enforced #2096 added cargo fmt --check to the same job.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions