Skip to content

lints: Google's Rust style guide as R30–R42; 18 zero-hit lints deny; small-hit lints fixed - #910

Merged
midagedev merged 2 commits into
mainfrom
lint-google-guide-2
Oct 28, 2026
Merged

midagedev merged 2 commits into
mainfrom
lint-google-guide-2

Conversation

@midagedev

Copy link
Copy Markdown
Owner

Supersedes #899 (same change, rebased on main, plus the review fixes). Google published its Rust style guide on 2026-10-21. docs/rust-quality.md §9 maps each rule that is not codebase-tagged onto ours as R30–R42. Where a guide rule conflicts with ours, ours stays: exhaustive in-tree enums, unwrap in tests and gates (R10), std::arch globs inside a #[target_feature] body, and poison recovery in the worker pool.

  • 18 clippy lints become deny at 0 hits.
  • Small-hit lints are fixed outside metal, hf, model-hf, serve, jinja, tokenizer and embed: redundant_clone, needless_for_each, default_trait_access, manual_let_else, implicit_clone, match_wildcard_for_single_variants, and a few single hits. Those seven lints still hit the mac crates (61 spans); a follow-up clears them and adds the seven as deny.
  • String + outside a kernel becomes one format! expression (37 sites, the lints: Google's Rust style guide as R30–R42; 18 zero-hit lints deny; small-hit lints fixed #899 review). R39 keeps push_str for kernels and steps.
  • ubatch_rule.rs is included by three seat modules; each carries #[allow(clippy::duplicate_mod)], so tools/lint-ratchet.txt goes from 3 to 0.

Proof: on bae1c27, just lint on the box is rc 0 with 0 ^warning:; just remote-static origin/main is green (708 s). Host-only change (narrow-scan identical before the review fixes, which touch host code and tests only). The fixture-tier union batch of main + this + #907 ran 269 items; its 8 reds were a stale qwen38 fixture budget, now re-recorded and green.

🤖 Generated with Claude Code

midagedev and others added 2 commits October 28, 2026 13:02
…42; fix the small-hit lints outside the mac crates

Google published its Rust style guide on 2026-10-21. docs/rust-quality.md
§9 maps each rule that is not codebase-tagged onto ours as R30–R42. Where a
rule conflicts with ours, ours stays: exhaustive enums, unwrap in tests and
gates, the glob import inside a target_feature body, and poison recovery
in the pool.

18 clippy lints are now deny at 0 hits. The small-hit lints are fixed
outside metal, hf, model-hf, serve, jinja, tokenizer and embed:
redundant_clone, string_add → push_str, needless_for_each,
default_trait_access, manual_let_else, implicit_clone, and others. The
duplicate_mod load of ubatch_rule.rs is gone, so the lint ratchet drops
from 3 to 0. Seven lints still hit the mac crates (61 spans). They stay
off the table until those crates are clear.

Proof: just lint, fmt and check are green. narrow-scan: the four PTX scans
are identical. remote-static is green. Cargo.lock is unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…s in force

The review on #899: the string_add rewrite had copied one 4-line block into
37 sites. Each is one format! expression again (tests and load-time code;
R39 keeps push_str for kernels and steps). place.rs builds the wanted name
once per stem. docs/rust-quality.md §9 drops the round's history and states
the adoption rule. body.rs drops a comment that was false after the move.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions github-actions Bot added documentation Improvements or additions to documentation gpu The card engine: crates/gpu*, crates/app host Host crates: qdot, threads, engram, engram-lab, runtime, sampler, levers, decision, vision, refset model The CPU engine and model files: crates/model, models, hf, gguf, tokenizer, jinja needs-gpu Changes code a card must check, and carries no gate run on a card placement Placement planning: crates/placement tools Tools, recipes, CI and the toolchain: tools/, justfile, .github/, Cargo labels Oct 28, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: CLEAN: the new commit fixes both earlier must-fix items and both ⚠ items, and adds no new defect.

Since the last review:

  • Must-fix 1 (format! idiom copied about 35 times): fixed. No { let mut out …; out.push('\n'); out } block is left in crates/. The sites now use format!("{}\n", lines.join("\n")). place.rs builds want once per stem (place.rs:867).
  • Must-fix 2 (false §9 text): fixed. The "Instrument for the counts" paragraph is gone. The rule is now "a lint is adopted as deny only at 0 spans". R39 limits push_str to a kernel or a step.
  • ⚠ duplicate_mod: answered. The PR body says the three seat modules each carry #[allow(clippy::duplicate_mod)], so the ratchet moves 3 → 0.
  • ⚠ stale comment at body.rs: fixed. The comment is deleted and let mut scan = run; stays (body.rs:1879). run is not read after it.

Checked

  • Duplicates: no new function, type or constant. dryer's 8 pairs are the check helper in the refset tests, which this commit does not touch.
  • Complexity: crapper flagged Place38::machine, header_typed, prompt_clauses and markov-accept::run. The new commit touches none of them.
  • Silent failure: 6 rewritten sites followed. Each builds the same string as before. mt.rs eprint of the joined text plus \n is now eprintln, with the same bytes. lookup_main still ends with def add_12(a, b):\n.
  • Tests: no assertion changed meaning; none added or removed.
  • Gates: 18 lints go to deny at 0 spans; none relaxed. No band or tolerance moved.
  • Performance: host and test code only. place.rs saves one String allocation per tensor per stem.
  • Escape catalog: no pattern matched.

Notes

  • The PR body has no nvidia-smi line and no gate output, so gpu.json evidence is false. The body says the change is host-only.
  • I could not run clippy. "0 hits" rests on the body's just lint claim, measured on bae1c2715.

Card check: needs-gpu. This pull request changes crates/gpu-deepseek41/src/body/snap.rs, crates/gpu-deepseek41/src/chain/attn.rs, crates/gpu-deepseek41/src/chain/attn/batch.rs … and carries no gate run on a card (CONTRIBUTING's evidence list); a maintainer adds gpu-verified after one.

🔨 Shingler, bloomery's review bot: approves a clean pull request and requests changes on a must-fix (how it works)

@midagedev
midagedev merged commit db40582 into main Oct 28, 2026
7 checks passed
@midagedev
midagedev deleted the lint-google-guide-2 branch October 28, 2026 07:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation gpu The card engine: crates/gpu*, crates/app host Host crates: qdot, threads, engram, engram-lab, runtime, sampler, levers, decision, vision, refset model The CPU engine and model files: crates/model, models, hf, gguf, tokenizer, jinja needs-gpu Changes code a card must check, and carries no gate run on a card placement Placement planning: crates/placement tools Tools, recipes, CI and the toolchain: tools/, justfile, .github/, Cargo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant