claude-memory/graph/configurations/cargo-check-post-edit-hook-for-rust-files-in-claude-code-a2d02a.md
2026-03-01 20:20:38 -06:00

82 lines
2.4 KiB
Markdown

---
id: a2d02aea-07fd-4528-8158-f2f42a23a2dd
type: configuration
title: "Cargo check post-edit hook for Rust files in Claude Code"
tags: [sba-scouting, rust, claude-code, hooks, linting, cargo, configuration, developer-experience]
importance: 0.65
confidence: 0.8
created: "2026-03-02T00:33:26.804471+00:00"
updated: "2026-03-02T02:20:38.872040+00:00"
relations:
- target: 73646e80-a640-4316-b7c6-54a4330f1b28
type: RELATED_TO
direction: outgoing
strength: 0.76
edge_id: 72478c93-188b-4e69-8809-5bfd4132e5a0
- target: fc4eb194-1b19-4bb7-8b63-97ae30c8a3e0
type: RELATED_TO
direction: outgoing
strength: 0.75
edge_id: 5a1bd148-d2be-4c98-a116-9068e0d7a6ee
- target: e9e6a15a-bec3-4b62-98c9-4a70a5165348
type: RELATED_TO
direction: outgoing
strength: 0.73
edge_id: c52bf965-695a-457a-a950-3e824dd87c0e
- target: 1d64c80d-61ec-434f-902a-3a511e2b92c2
type: FOLLOWS
direction: outgoing
strength: 0.6
edge_id: 0e1c4047-45b6-4e4e-92b0-d354a495a23c
- target: 77c0b897-4124-432f-84de-700ff82dcde1
type: RELATED_TO
direction: outgoing
strength: 0.5
edge_id: b0015c81-b5ab-4972-8811-04dc5ddaebf4
- target: be0bda86-d893-4f86-97c4-0ca4e1073121
type: RELATED_TO
direction: incoming
strength: 0.8
edge_id: ceebc50e-6db0-444e-b31d-36344913dc12
- target: be0bda86-d893-4f86-97c4-0ca4e1073121
type: SOLVES
direction: incoming
strength: 0.95
edge_id: b5623458-9ace-43ae-ae7e-101d465498ee
---
# Cargo Check Post-Edit Hook Configuration
## File
`rust/.claude/settings.json`
## Purpose
Runs `cargo check --message-format=short` automatically after any Edit or Write to `.rs` files during a Claude Code session. Provides fast feedback without waiting for a manual build.
## Why cargo check (not clippy)
- `cargo clippy` is too slow for every single edit (takes several seconds)
- `cargo check` is faster — catches type errors and borrow checker issues quickly
- Clippy should be run manually at logical checkpoints:
- Before commits
- After finishing a feature
- After batch edits to multiple files
## Settings JSON Structure
```json
{
"hooks": {
"PostToolUse": [
{
"matcher": { "tool_name": ["Edit", "Write"], "file_paths": [".*\\.rs$"] },
"hooks": [
{ "type": "command", "command": "cargo check --message-format=short" }
]
}
]
}
}
```
## Documentation
Also documented in `rust/CLAUDE.md` for future session context.