It also covers correcting the recurring failure modes of machine-generated Rust: the clone
tax (cloning to silence the borrow checker instead of redesigning ownership), unwrap/expect
infestation, String vs &str misuse, indexed loops instead of iterators, and over-annotated
lifetimes the compiler could elide.
Out of scope: error-type design (thiserror vs anyhow) belongs to rust-error-handling; async
runtime questions belong to rust-async-concurrency; SOLID/file-layout rules belong to
fuse-solid:solid-rust.
Rust Core Language
Idiomatic Rust for stable 1.96.1, edition 2024. This skill covers what the
compiler will not catch for you: ownership design that avoids gratuitous cloning,
and the recurring failure modes of machine-generated Rust.
Agent Workflow (MANDATORY)
- fuse-ai-pilot:research-expert — confirm the current stable version and any
feature's stabilization release before relying on it (versions move fast).
- fuse-ai-pilot:explore-codebase — read the crate's
edition in Cargo.toml
and its existing ownership conventions before adding code.
- After writing code, run fuse-ai-pilot:sniper and
cargo clippy.
Never state a stabilization version from memory — verify against
doc.rust-lang.org/releases.html.
Overview
| Topic |
When |
| Edition 2024 features |
Setting up a crate, using let chains / async closures |
| Ownership & borrowing |
Designing function signatures and data flow |
| LLM pitfalls |
Reviewing or repairing generated Rust before merge |
Critical Rules
- Borrow before you own. Take
&T / &str / &[T] in parameters unless the
function must keep the value. See ownership-borrowing.md.
.clone() needs a reason. A clone to silence a borrow-checker error is a
design smell (the "clone tax"). Redesign ownership first; clone only when a
second owner genuinely exists.
- No
.unwrap() / .expect() on fallible values without a written justification.
Grep for them before merge. Prefer ?, match, or a documented invariant.
Arc::clone(&x) over x.clone() for reference-counted handles — it makes the
cheap pointer-copy explicit and distinguishes it from a deep clone.
- Iterators over indexed loops. Prefer
iter()/map()/filter()/collect() to
for i in 0..len { v[i] } — no bounds-check noise, no off-by-one.
- Let elision work. Do not annotate lifetimes the compiler can infer.
Verified Facts (source-checked)
- Edition 2024 stabilized in Rust 1.85.0 (2025-02-20), RFC #3501.
- Let chains (
if let A = x && let B = y && cond) stabilized in 1.88.0
(2025-06-26), edition 2024 only — depends on the if let temporary-scope change.
- Async closures (
async || { .. }) stabilized in 1.85.0.
gen blocks are UNSTABLE — feature gate #![feature(gen_blocks)], tracking
issue rust-lang/rust#117078, RFC #3513. Do NOT use on stable; the returned
iterators are not yet fused and the syntax may still change.
Reference Guide
Concepts
| Topic |
Reference |
Load when |
| Edition 2024 |
edition-2024.md |
Configuring edition, using let chains / async closures, checking feature stability |
| Ownership & borrowing |
ownership-borrowing.md |
Choosing owned vs borrowed params, designing lifetimes, sharing with Rc/Arc |
| LLM pitfalls |
llm-pitfalls.md |
Reviewing generated Rust for clone tax, unwrap infestation, String/&str, indexed loops |
Templates
| Template |
Load when |
| idiomatic-code.md |
Need copy-paste examples of borrow-first signatures, iterator chains, and let chains |
Validation Checklist
1---2name: rust-core-language3description: Use when writing or reviewing idiomatic Rust — edition 2024 ownership/borrowing design, or fixing LLM pitfalls (clone tax, unwrap infestation, indexed loops). Not for error-type design (rust-error-handling) or SOLID layout (solid-rust).4---56<objective>7This skill covers idiomatic Rust for stable 1.96.1, edition 2024: designing function8signatures and data flow around ownership and borrowing, and using edition-2024 features9(let chains, async closures) correctly.1011It also covers correcting the recurring failure modes of machine-generated Rust: the clone12tax (cloning to silence the borrow checker instead of redesigning ownership), unwrap/expect13infestation, String vs &str misuse, indexed loops instead of iterators, and over-annotated14lifetimes the compiler could elide.1516Out of scope: error-type design (thiserror vs anyhow) belongs to rust-error-handling; async17runtime questions belong to rust-async-concurrency; SOLID/file-layout rules belong to18fuse-solid:solid-rust.19</objective>2021# Rust Core Language2223Idiomatic Rust for stable **1.96.1**, **edition 2024**. This skill covers what the24compiler will not catch for you: ownership design that avoids gratuitous cloning,25and the recurring failure modes of machine-generated Rust.2627## Agent Workflow (MANDATORY)28291. **fuse-ai-pilot:research-expert** — confirm the current stable version and any30 feature's stabilization release before relying on it (versions move fast).312. **fuse-ai-pilot:explore-codebase** — read the crate's `edition` in `Cargo.toml`32 and its existing ownership conventions before adding code.333. After writing code, run **fuse-ai-pilot:sniper** and `cargo clippy`.3435Never state a stabilization version from memory — verify against36`doc.rust-lang.org/releases.html`.3738## Overview3940| Topic | When |41|-------|------|42| Edition 2024 features | Setting up a crate, using let chains / async closures |43| Ownership & borrowing | Designing function signatures and data flow |44| LLM pitfalls | Reviewing or repairing generated Rust before merge |4546## Critical Rules47481. **Borrow before you own.** Take `&T` / `&str` / `&[T]` in parameters unless the49 function must keep the value. See [ownership-borrowing.md](references/ownership-borrowing.md).502. **`.clone()` needs a reason.** A clone to silence a borrow-checker error is a51 design smell (the "clone tax"). Redesign ownership first; clone only when a52 second owner genuinely exists.533. **No `.unwrap()` / `.expect()` on fallible values without a written justification.**54 Grep for them before merge. Prefer `?`, `match`, or a documented invariant.554. **`Arc::clone(&x)` over `x.clone()`** for reference-counted handles — it makes the56 cheap pointer-copy explicit and distinguishes it from a deep clone.575. **Iterators over indexed loops.** Prefer `iter()/map()/filter()/collect()` to58 `for i in 0..len { v[i] }` — no bounds-check noise, no off-by-one.596. **Let elision work.** Do not annotate lifetimes the compiler can infer.6061## Verified Facts (source-checked)6263- **Edition 2024** stabilized in Rust **1.85.0** (2025-02-20), RFC #3501.64- **Let chains** (`if let A = x && let B = y && cond`) stabilized in **1.88.0**65 (2025-06-26), **edition 2024 only** — depends on the `if let` temporary-scope change.66- **Async closures** (`async || { .. }`) stabilized in **1.85.0**.67- **`gen` blocks are UNSTABLE** — feature gate `#![feature(gen_blocks)]`, tracking68 issue rust-lang/rust#117078, RFC #3513. Do NOT use on stable; the returned69 iterators are not yet fused and the syntax may still change.7071## Reference Guide7273### Concepts7475| Topic | Reference | Load when |76|-------|-----------|-----------|77| Edition 2024 | [edition-2024.md](references/edition-2024.md) | Configuring `edition`, using let chains / async closures, checking feature stability |78| Ownership & borrowing | [ownership-borrowing.md](references/ownership-borrowing.md) | Choosing owned vs borrowed params, designing lifetimes, sharing with Rc/Arc |79| LLM pitfalls | [llm-pitfalls.md](references/llm-pitfalls.md) | Reviewing generated Rust for clone tax, unwrap infestation, String/&str, indexed loops |8081### Templates8283| Template | Load when |84|----------|-----------|85| [idiomatic-code.md](references/templates/idiomatic-code.md) | Need copy-paste examples of borrow-first signatures, iterator chains, and let chains |8687## Validation Checklist8889- [ ] `Cargo.toml` declares `edition = "2024"` if edition-2024 features are used90- [ ] No `.clone()` added purely to satisfy the borrow checker91- [ ] Every `.unwrap()`/`.expect()` has a justifying comment or is provably infallible92- [ ] Parameters take references unless ownership is required93- [ ] No lifetime annotations the compiler can elide94- [ ] `cargo clippy` clean, sniper passed