Skip to content

Make the Rust code rustfmt and clippy clean, then check both in CI #38

Closed

Description

@chrislaupama

Background

The CI lint job (added in #22) checks workflows and shell scripts, but not Rust formatting or clippy, because the tree is clean for neither:

  • There is no rustfmt.toml, and cargo fmt --all rewrites around 150 files. Contributors have to avoid running it and format only their own new files.
  • cargo clippy --workspace --all-targets -- -D warnings fails in dstudio-core (for example large_enum_variant in assistant.rs, redundant closures, and deny-level lints in the builtin/eq.rs tests). Newer toolchains add more.

What to do

  1. Add a rustfmt.toml matching the current style as closely as possible (the code uses long lines, so max_width is likely well above 100), then run cargo fmt --all in one PR with no other changes, so the reformat is easy to review and to skip in git blame (add the commit to .git-blame-ignore-revs).
  2. Fix or explicitly allow the clippy findings, crate by crate (small PRs). Prefer fixes; use targeted #[allow] with a reason where a lint doesn't fit (e.g. real-time code).
  3. Add cargo fmt --all --check and cargo clippy --workspace --all-targets -- -D warnings to the lint job, pinned to the toolchain CI already uses, so a new Rust release doesn't turn the job red overnight.

When it's done

  • lint runs both checks and is green on main.
  • AGENTS.md / CONTRIBUTING no longer warn against running cargo fmt.

Large mechanical PRs conflict with everything open, so coordinate the reformat for a moment with few open PRs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

github_actionsPull requests that update GitHub Actions codegood first issueGood for newcomers

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions