toolchains-rust-core
Installation
SKILL.md
Contains Shell Commands
This skill contains shell command directives (!`command`) that may execute system commands. Review carefully before installing.
Rust Core Toolchain Conventions
Edition and Toolchain
- Target Rust 2024 edition. MSRV is set by the most-constrained transitive dependency,
not the edition floor — pin it explicitly in
Cargo.toml(rust-version = "..."). - Gate every change on
cargo fmt --check,cargo clippy -- -D warnings, andcargo test. - Prefer
cargo nextest runfor faster, isolated test execution when available.
Ownership and Borrowing
- Borrow by default, own only when necessary. Accept
&str/&[T]in function signatures, notString/Vec<T>, unless the function must take ownership. - Return owned values; let callers borrow. Avoid returning references tied to locals.
- Reach for
Cow<'_, str>when a value is usually borrowed but occasionally owned. - Use
Rc/Arconly for genuine shared ownership; prefer passing references first. - Interior mutability:
Cell/RefCellfor single-threaded,Mutex/RwLock(underArc) for shared-state concurrency. Never hold a lock across an.await.