rust-style

Applies Rust house style rules for edition 2024 crates, unsafe validation, fuzzing, and mutation testing.

Updated Aug 5, 2026
One-click install
npx skills add https://github.com/harivansh-afk/loom-index-e2e --skill rust-style-harivansh-afk
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: rust-style
Source: https://github.com/harivansh-afk/loom-index-e2e/tree/main/skills/rust-style
Command: npx skills add https://github.com/harivansh-afk/loom-index-e2e --skill rust-style-harivansh-afk

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Rust contributors in Nix monorepos like ix and index face inconsistent formatting rules, hard-to-find per-crate Clippy check attributes, and unclear guidance on validating unsafe code, concurrency, and untrusted input surfaces. This Skill consolidates the house style so code passes CI and review on the first attempt. ## Core Features & Use Cases - Repo-aware formatting and linting: Distinguishes ix (enforced rustfmt via nix fmt) from index (no rustfmt; Clippy and review only), and gives the exact Nix attribute paths for per-crate Clippy checks in each repo. - Unsafe and concurrency validation: Directs Miri, cargo-careful, loom, and shuttle usage based on what each tool can and cannot model. - Testing depth guidance: Covers cargo-mutants for mutation testing and cargo-fuzz scaffolding for parsers, codecs, and FFI-adjacent input edges. - Use Case: While writing a new NBT parser crate, you follow the skill to scaffold cargo fuzz init, commit minimized crash seeds, and run the correct nix build .#ciChecks...clippy attribute so CI passes without diff noise. ## Quick Start Review my new Rust crate against the house style and tell me which Clippy check command and unsafe-code validation steps to run before opening the PR.

Frequently Asked Questions about rust-style

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I run the same Clippy checks as CI in a Nix Rust monorepo?▼

In index, run nix build .#ciChecks.x86_64-linux.<unit>.clippy where the unit is usually rust-<crate-name>. In ix, use nix build .#legacyPackages.x86_64-linux.rustClippyChecksByPackage.<cargo-package-name>, keyed by the Cargo.toml package name.

Should I run cargo fmt in the index repository?▼

No. Index has no rustfmt.toml and no lint stage formats Rust, so cargo fmt only produces diff noise. Style there is enforced by Clippy and code review; in ix, run nix fmt -- <paths> instead.

Miri vs cargo-careful for validating unsafe Rust code?▼

Run Miri first where it works. For blocks Miri rejects due to FFI, syscalls, or native execution, use cargo +nightly careful test, which checks against a debug-assertion stdlib but does not model aliasing, uninitialized reads, or data races.

When should I use loom versus shuttle for concurrency testing?▼

Use loom for small deterministic concurrency primitives whose state fits modeled threads and atomics. Use shuttle for larger randomized scheduler tests, especially Tokio-shaped workflows. Skip both when the test would only prove a dependency's lock or runtime works.

How do I set up fuzzing for a Rust parser crate?▼

Scaffold with cargo fuzz init so targets land in packages/<crate>/fuzz/fuzz_targets/, keep the fuzz crate's own [workspace] table, commit hand-picked seeds under fuzz/seeds/<target>/, gitignore fuzz/corpus/, and minimize crashes with cargo fuzz cmin or tmin before committing regression seeds.

Should cargo-mutants run as a CI gate?▼

No. Keep cargo-mutants a package-owner tool rather than a CI gate, because equivalent mutants need human judgment, runtime scales with mutant count, and a surviving mutant is a prompt to investigate, not a regression to block.