This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Local fork of the official rustlings exercises for learning Rust. The repo contains 100+ exercises across 24 categories (variables, ownership, traits, lifetimes, etc.) with corresponding solutions. Each exercise is a standalone binary target defined in Cargo.toml.
There is no src/ directory — all code lives in exercises/ and solutions/ as individual .rs files.
All commands use Task as the task runner:
task install # Install all deps (mise, rustup, sccache, rustlings, cargo-nextest)
task test # Run tests via cargo nextest (falls back to cargo test)
task lint # Run cargo clippy --workspace
task format # Run cargo fmt --all
task pre-commit # Run pre-commit hooks via prek
task build:timings # Analyze build performanceRun the interactive exercise runner:
rustlingsRun a single exercise directly:
run exercises/01_variables/variables1.rsRun tests for a specific exercise:
cargo nextest run --bin variables1- Runtime management:
mise(see.tool-versionsfor pinned versions) - Rust toolchain: nightly (pinned in
.tool-versions) - Rust edition: 2024
- Compilation cache: sccache (
RUSTC_WRAPPER=sccache) - Test runner: cargo-nextest (installed via cargo-binstall)
- Pre-commit: prek
- Env precedence:
TASK_X_ENV_PRECEDENCE=1in.envmakes Taskfile env override OS env (required for PATH manipulation)
The global env: block in taskfile.yml sets:
CARGO_HOMEandCARGO_TARGET_DIRto.cache/cargoandtargetunder the project rootPATHprepends mise shims,~/.local/bin, and cargo bin dir (strips IDE globalStorage paths)RUSTFLAGSenables multi-threaded compilation (-Zthreads=N)CARGO_BUILD_JOBSreserves 2 cores for system (min 1 job)
Defined in Cargo.toml:
unsafe_code = "forbid"— no unsafe allowedunstable_features = "forbid"— no nightly-only features in exercisesdead_code = "allow"— exercises often have unused codetodo = "forbid"(clippy) — no unfinished TODOsempty_loop = "forbid"/infinite_loop = "deny"(clippy)
Each exercise follows this pattern:
// Exercise code with TODO markers or deliberate errors for the learner to fix
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_name() {
assert!(condition);
}
}Exercises live in exercises/<NN_topic>/ and solutions mirror at solutions/<NN_topic>/. Both are registered as [[bin]] targets in Cargo.toml.
Always use Context7 MCP when I need library/API documentation, code generation, setup or configuration steps without me having to explicitly ask.
- jdx/mise
- nextest-rs/nextest
- websites/taskfile_dev