This repository is a Rust library project template intended to establish a quality baseline for new Rust crates (and to act as a reference checklist for improving existing ones).
It is a practical baseline for the proposal “Rust Project Template: Establishing a Quality Baseline”:
- Minimal by default: no dependencies are included unless you add them.
- Policy + automation: MSRV and dependency-version discipline is encouraged and enforced via CI.
- “Complete project” defaults: CI, formatting/linting, security policy, contribution & governance scaffolding, issue/PR templates.
You can instantiate a new crate by using GitHub’s “Use this template” button.
After creation:
- Rename placeholders in
Cargo.tomland the repository docs/templates (see First-time setup checklist and File-by-file customization). - Decide your MSRV policy and align it across
rust-toolchain.toml,Cargo.toml(edition), and CI. - Pick a license and ensure your
Cargo.tomllicensefield matches.
If this is your first time creating a repository from this template, use this checklist before you start writing code:
- Update crate/package metadata in
Cargo.toml- Replace
namewith your crate name. - Replace
descriptionwith a real one-line summary. - Replace
repositorywith your repository URL. - Replace
authorswith the actual maintainers, if you use that field. - Replace
licenseif you are not shipping MIT.
- Replace
- Choose which license files to keep
- Keep only the license file(s) that apply to your project.
- Make sure the
Cargo.tomllicensefield matches the files you ship.
- Replace organization/project-specific names and links
- Search the repository for the template values and replace them with your own project details.
- At minimum, search for:
rust-project-templateOpenZeppelinopenzeppelin0xNeshiproject description
- Update maintainer/contact information
- Set the correct owners in
.github/CODEOWNERS. - Update security reporting instructions in
SECURITY.md. - Update support/community links in GitHub issue templates if you use them.
- Set the correct owners in
- Review CI and toolchain policy
- Set your MSRV in workflow files.
- Confirm
editionis compatible with your MSRV. - Decide whether
rust-toolchain.tomlshould stay pinned.
- Trim anything you do not use
- Remove workflows you do not need (
nostd.yml,safety.yml, etc.). - Remove example/bench scaffolding if it is not useful for your crate.
- Remove workflows you do not need (
After the checklist, run a sanity check:
cargo test --all-features --all-targets
cargo +nightly fmt --check
cargo clippy --all-features --all-targetsThe included workflows aim to catch common library pitfalls early:
- Formatting (
cargo fmt --check) - Clippy on stable and beta (early warning on new lints)
- Docs build (runs on nightly using
cargo docs-rs) - Feature combination testing via
cargo hack --feature-powerset check - MSRV check (builds on the configured minimal toolchain in CI)
- Tests on stable & beta, plus macOS + Windows
- Minimal dependency versions (
-Zminimal-versions) to ensure your version requirements are honest - Coverage via
cargo-llvm-cov+ Codecov - Optional safety checks (Miri, sanitizers, Loom)
- Optional no-std checks
- Scheduled “rolling” jobs (nightly toolchain + updated dependencies)
You get a baseline set of project meta-files (security policy, code of conduct, changelog format, issue and PR templates, etc.) so that new crates don’t ship with “missing basics”.
This template is meant for libraries, where compatibility matters.
- MSRV should be a conscious choice (often ~6–12 months old at project creation, unless you need older support).
- Be conservative when bumping MSRV after publishing.
- Use the minimal Rust edition supported by your MSRV.
Important: In this repo as-shipped, rust-toolchain.toml pins a specific
toolchain, while CI includes an MSRV job. When you instantiate a new project,
you should make these consistent for your crate.
This section is a concrete map of which files usually need project-specific names, links, maintainers, and policy choices changed after you create a new repository from this template.
- Must update:
namedescriptionrepositorylicenseauthors(if applicable)keywordsandcategoriesonce you know how you want to publish the crate
- Review:
edition(must align with your MSRV)lints.*(tune warning levels for your team)profile.release(keep or adjust based on your needs)
- Dependencies:
- The template intentionally has none. Add only what you need.
- Prefer specifying minimally-supported dependency versions (don’t just “float to latest” for libraries).
- Decide whether you want:
- Pinned toolchain (reproducibility for contributors), or
- Floating stable (less maintenance)
- If you keep a pinned toolchain, ensure CI still tests stable/beta/nightly as appropriate.
check.yml:- Formatting, clippy (stable/beta), docs, feature-powerset (
cargo-hack), and MSRV check. - Update the MSRV value in the matrix to your crate’s MSRV.
- Formatting, clippy (stable/beta), docs, feature-powerset (
test.yml:- Tests on stable/beta, minimal dependency versions, OS matrix, coverage.
scheduled.yml:- Nightly “rolling” checks and “updated dependencies” checks.
- Review repository-specific job names, notifications, and assumptions.
safety.yml:- Optional deeper checks (sanitizers, Miri, Loom). Remove if irrelevant.
- Note: this workflow installs system packages; keep only if you want it.
nostd.yml:- Only keep if your crate supports
no_std(and configure targets/features).
- Only keep if your crate supports
- Keeps GitHub Actions up to date.
- For Cargo dependencies, it’s configured with library-friendly defaults. Review the ignore rules if your repository also ships binaries.
- Add correct GitHub handles/teams.
- Ensure
SECURITY.mdhas the right owners.
- Adjust wording to your project.
- Replace support links, repository links, and organization names.
- Tune formatting and clippy settings to team preferences.
rustfmt.tomlincludes settings that may require nightly rustfmt depending on your toolchain; adjust if you need strict stable-only formatting.clippy.tomlmay include organization-specific identifiers; reviewdoc-valid-idents.
- Decide your coverage target and what to ignore.
- If you use Codecov, configure
CODECOV_TOKENin repo secrets as needed.
- Follows “Keep a Changelog” and Semantic Versioning.
- Keep it up to date for user-visible changes.
- Update the project name, organization name, and repository slug.
- Replace the vulnerability reporting contact/channel with your own.
- Ensure the advisory submission link points to your repository.
- Review any legal text inherited from the template owner.
- Keep as-is, or replace with your organization’s standard CoC.
- If you keep this file, review the enforcement/reporting contact details.
- This file is currently a stub in this template repository. Fill it with your project’s contribution workflow (local setup, testing requirements, release process, etc.).
- Choose the license(s) that apply to your project.
- Ensure
Cargo.tomllicense = "..."matches what you ship. - Remove any licenses you do not intend to ship.
- If your chosen license requires copyright holder updates, make those changes.
- Replace the placeholder code with your crate’s public API.
- Keep
#![deny(missing_docs)]/docs expectations aligned with your lint policy (seeCargo.tomllints).
- Optional editor configuration.
- E.g. configures cargo formatter to always run in
nightlyto access latest formatting features. - Keep, adjust, or remove.
Before your first release, do one repository-wide search for template values and verify each remaining match is intentional.
Suggested search terms:
rust-project-templateOpenZeppelinopenzeppelin0xNeshiproject description
You can also use this repository as a reference checklist for existing Rust projects:
- Add missing governance/meta-files.
- Adopt the CI workflows incrementally.
- Introduce MSRV + minimal-deps checks to avoid accidental ecosystem breakage.
The GitHub Actions CI workflows under .github/workflows/ are based on the
excellent work in:
This template intentionally keeps the same general approach (including minimal dependency testing and feature-combination checks), because it has proven to be a solid baseline for Rust libraries.