init-rust
init-rust
Generate Rust tooling configuration files for a new project. This skill is used by the init-project skill but can also be used standalone.
Files to Generate
- Copy
assets/Cargo.tomlinto the target directory and substitute<project-or-subdirectory-name>with the actual project (or subdirectory) name. It ships pedantic clippy lints plus tuneddev/releaseprofiles (thin debug info; LTO +codegen-units = 1+strip+panic = "abort"for release). Profiles only take effect in a workspace-root manifest — if you're initialising a workspace member, move the two[profile.*]tables to the rootCargo.toml. - Copy
assets/cargo-config.tomlto.cargo/config.tomlat the project (or workspace) root. It wires mold as the linker on Linux targets (see below). Skip this file for a workspace member — a single.cargo/config.tomlat the root covers the whole workspace.
Build performance
These are the highest-leverage, low-effort speedups for Rust. The two levers are caching compilation (sccache) and faster linking (mold) — they're complementary: sccache skips recompiling unchanged crates, mold speeds up the link that happens even on a full cache hit.
Faster linking — mold (Linux only)
Shipped in assets/cargo-config.toml, scoped to x86_64/aarch64-unknown-linux-gnu. mold is ~3-10x faster than GNU ld on large dependency graphs, and linking is exactly what sccache can't cache. Contributors on Linux (and CI/Docker Linux stages) must install mold: apt-get install mold / dnf install mold / pacman -S mold.
macOS: deliberately not configured. mold cannot link Mach-O (its macOS port sold was discontinued), and Apple's default linker (ld-prime, Xcode 15+) is already fast. Do not set a global -fuse-ld=mold — it will break native macOS builds. If you want a faster-than-default linker on older macOS, lld (brew install llvm, then -fuse-ld=lld) is the option, but on current Xcode the default is fine.