Skip to content

shuymn/rust-template

Repository files navigation

rust-template

Minimal Rust template with:

  • Taskfile.yml as the primary entrypoint for local tasks, CI, and hooks
  • Nightly toolchain with opinionated rustfmt.toml, clippy.toml, and Cargo.toml [lints]; clippy::pedantic / nursery / cargo enabled at the crate root
  • lefthook.yml for pre-commit and pre-push automation
  • GitHub Actions running the same task commands as local development
  • Starter docs for repository rules and review conventions

Template source: https://github.com/shuymn/rust-template (shuymn/rust-template).

This repository was initialized from a Rust project template.

Replace this README with project-specific documentation once the repository has a clear purpose, setup flow, and release process.

Local Setup

Install Rust (rustup). This repo pins nightly in rust-toolchain.toml (run rustup show in the repo root after clone — rustup should install it automatically). Optional: Task and Lefthook.

Primary entrypoint:

task
task build
task test
task lint
task fmt
task check

After installing Lefthook, enable hooks:

lefthook install

Rust-native equivalents (same nightly toolchain as rust-toolchain.toml):

cargo build
cargo test
cargo fmt --all -- --check   # uses nightly rustfmt + rustfmt.toml
cargo clippy --workspace --all-targets --all-features --locked -- -D warnings

Initial Customization

Before treating this as a real project, update the repository-specific parts:

  1. Run template initialization from the repository root. This rewrites template placeholders, removes the template-only README section, deletes .taskfiles/, and creates a local commit.
task -t .taskfiles/template.yml init
  1. Replace src/main.rs and any starter code with your actual application.
  2. Rewrite this README with your project's purpose, setup, development workflow, and release information.
  3. Review AGENTS.md and docs/ and keep only the rules and guidance you want in this repository.
  4. Run task check before your first project-specific commit (requires Lefthook on PATH for the install:lefthook dependency, or run task fmt:check, task lint, task test, task doc, and task build individually).

Suggested README Sections

When you rewrite this file, include only the sections your project actually needs, for example:

  • Project overview
  • Requirements
  • Setup
  • Local development commands
  • Testing
  • Deployment or release process
  • Repository layout
  • Links to deeper docs if needed

About

Minimal Rust project template with nightly toolchain, Taskfile, Clippy pedantic lints, Lefthook hooks, and GitHub Actions CI

Topics

Resources

License

Stars

Watchers

Forks

Contributors

Languages