just: add check recipe (fmt + clippy + test) #10

Closed
opened 2026-07-05 03:20:43 +08:00 by weiwen · 0 comments
Owner

Why

Nothing in the repo runs cargo fmt/clippy/test today: there is no CI, and .sandcastle/implement-prompt.md tells the agent to run npm run typecheck && npm run test — but this is a Rust project with no npm scripts, so the feedback loop is a no-op. We want one canonical command the reviewer and implementer both run, plus baseline lint hardening enforced by clippy.

What

1. Justfile recipes

Add to the root Justfile:

  • fmtcargo fmt
  • lintcargo clippy --all-targets -- -D warnings
  • testcargo test
  • checkcargo fmt --check + cargo clippy --all-targets -- -D warnings + cargo test (composes the above; this is the recipe the review flow calls)

Clippy runs with -D warnings so warnings are hard failures. The existing sandcastle recipe stays.

2. Cargo.toml: lint table + edition 2024

Bump the crate to Rust 2024 and add denied unsafe-hygiene lints. evie is a single crate, so make it its own workspace root (bare [workspace] table) and opt the package in via [lints] workspace = true:

```toml
[package]
edition = "2024" # was 2021

[workspace]

[workspace.lints.rust]
unsafe_code = "deny"
unsafe_op_in_unsafe_fn = "deny"
unused_unsafe = "deny"

[workspace.lints.clippy]
missing_safety_doc = "deny"
multiple_unsafe_ops_per_block = "deny"
undocumented_unsafe_blocks = "deny"
unnecessary_safety_comment = "deny"

[lints]
workspace = true
```

(Equivalent single-crate form without [workspace] is [lints.rust]/[lints.clippy] directly — use whichever is cleaner, but the opt-in must be present or the lints do nothing.)

The codebase currently has no unsafe, so unsafe_code = \"deny\" is safe to add. The edition bump may need a cargo fix --edition migration pass — run it and commit any resulting churn.

Acceptance criteria

  • just check runs fmt-check, clippy (warnings = error), and tests in sequence; fails on any violation.
  • just fmt / just lint / just test work standalone.
  • Crate builds on edition = \"2024\".
  • The workspace lint table is active (verify: temporarily add an unsafe {} block and confirm cargo clippy denies it, then revert).
  • Repo passes just check after the changes.

Notes

Recipes call cargo directly (not via nix) — the nix env is provided by the caller (nix develop .#ci -c just check). Independent of the flake/Dockerfile issues for authoring, but only runnable in the sandbox once #9 and #11 land.

## Why Nothing in the repo runs `cargo fmt`/`clippy`/`test` today: there is no CI, and `.sandcastle/implement-prompt.md` tells the agent to run `npm run typecheck && npm run test` — but this is a Rust project with no npm scripts, so the feedback loop is a no-op. We want one canonical command the reviewer and implementer both run, plus baseline lint hardening enforced by clippy. ## What ### 1. Justfile recipes Add to the root `Justfile`: - `fmt` → `cargo fmt` - `lint` → `cargo clippy --all-targets -- -D warnings` - `test` → `cargo test` - `check` → `cargo fmt --check` + `cargo clippy --all-targets -- -D warnings` + `cargo test` (composes the above; this is the recipe the review flow calls) Clippy runs with `-D warnings` so warnings are hard failures. The existing `sandcastle` recipe stays. ### 2. Cargo.toml: lint table + edition 2024 Bump the crate to Rust 2024 and add denied unsafe-hygiene lints. evie is a single crate, so make it its own workspace root (bare `[workspace]` table) and opt the package in via `[lints] workspace = true`: \`\`\`toml [package] edition = \"2024\" # was 2021 [workspace] [workspace.lints.rust] unsafe_code = \"deny\" unsafe_op_in_unsafe_fn = \"deny\" unused_unsafe = \"deny\" [workspace.lints.clippy] missing_safety_doc = \"deny\" multiple_unsafe_ops_per_block = \"deny\" undocumented_unsafe_blocks = \"deny\" unnecessary_safety_comment = \"deny\" [lints] workspace = true \`\`\` (Equivalent single-crate form without `[workspace]` is `[lints.rust]`/`[lints.clippy]` directly — use whichever is cleaner, but the opt-in must be present or the lints do nothing.) The codebase currently has **no `unsafe`**, so `unsafe_code = \"deny\"` is safe to add. The edition bump may need a `cargo fix --edition` migration pass — run it and commit any resulting churn. ## Acceptance criteria - `just check` runs fmt-check, clippy (warnings = error), and tests in sequence; fails on any violation. - `just fmt` / `just lint` / `just test` work standalone. - Crate builds on `edition = \"2024\"`. - The workspace lint table is active (verify: temporarily add an `unsafe {}` block and confirm `cargo clippy` denies it, then revert). - Repo passes `just check` after the changes. ## Notes Recipes call `cargo` directly (not via nix) — the nix env is provided by the caller (`nix develop .#ci -c just check`). Independent of the flake/Dockerfile issues for *authoring*, but only *runnable in the sandbox* once #9 and #11 land.
weiwen 2026-07-05 03:54:23 +08:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
weiwen/evie#10
No description provided.