Files
codex/prs/bolinfest/study/PR-1582-study.md
2025-09-02 15:17:45 -07:00

2.0 KiB
Raw Blame History

DOs

  • Bold: Use VS Code rust-analyzer + rustfmt settings aligned with the repo.
// .vscode/settings.json
{
  "rust-analyzer.checkOnSave": true,
  "rust-analyzer.check.command": "clippy",
  "rust-analyzer.check.extraArgs": ["--all-features", "--tests"],
  "rust-analyzer.rustfmt.extraArgs": ["--config", "imports_granularity=Item"],
  "[rust]": {
    "editor.defaultFormatter": "rust-lang.rust-analyzer",
    "editor.formatOnSave": true
  }
}
  • Bold: Enforce item-level import formatting (what the rustfmt arg does).
// Before (collapsed)
use std::collections::{HashMap, HashSet};

// After (Item granularity)
use std::collections::HashMap;
use std::collections::HashSet;
  • Bold: Use just tasks for formatting and lint fixes.
# From codex-rs/
just fmt
just fix -p codex-tui    # or the crate you changed
  • Bold: Run tests to verify changes.
# Test the changed crate first
cargo test -p codex-tui

# If you touched common/core/protocol, run the full suite
cargo test --all-features
  • Bold: End files with a trailing newline.
 // Good: editor adds a final newline automatically
 {
   "some": "json"
 }
+

DONTs

  • Bold: Dont switch instructions or tooling to make—stick with the justfile.
// Bad (dont add to AGENTS.md)
After changes, run `make format` and `make fix`.

// Good
After changes, run `just fmt` and `just fix -p <project>`.
  • Bold: Dont omit the rustfmt extra arg—imports wont match project style.
// Bad: missing rust-analyzer.rustfmt.extraArgs
{
  "rust-analyzer.checkOnSave": true,
  "rust-analyzer.check.command": "clippy",
  "rust-analyzer.check.extraArgs": ["--all-features", "--tests"]
}
  • Bold: Dont leave files without a final newline.
 {
   "some": "json"
-}
\ No newline at end of file
+}
  • Bold: Dont rely on default import grouping when the repo specifies Item granularity.
// Bad
use crate::{api, config, ui};

// Good
use crate::api;
use crate::config;
use crate::ui;