Skip to content

A template for your next Rust project.

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

tomkarw/opinionated-rust-template

Repository files navigation

Opinionated Rust Template

A template for your next Rust project.

To start coding run:

cargo generate tomkarw/opinionated-rust-template

Only requires just to bootstrap all tools and configuration:

cargo install just

Includes:

  • quite strict clippy warnings; some lints are explicitly denied (those that have easy idiomatic alternatives).
  • opinionated rustfmt configuration: separate imports by std/external/crate, import granularity at module level and formatting string literals
  • just init for installing all necessary tools
  • pre-commit hooks for cargo {fmt,clippy,test}
  • just pre-commit command that additionally includes a spellcheck
  • GitHub CI pipeline taken from hyper project pipeline
  • skeleton for integration and e2e tests
  • skeleton for benchmarks with criterion
  • MIT and Apache 2.0 licenses

Description of included things

  • Conventional Commit - a specification for adding human and machine-readable meaning to commit messages
  • just - handy way to save and run project-specific commands
  • cargo-binstall - binary installation for Rust projects
  • pre-commit - framework for managing and maintaining multi-language pre-commit hooks
  • cargo-nextest - next-generation test runner
  • cargo-spellcheck - check your spelling with hunspell and/or nlprule
  • cargo-llvm-cov - easily use LLVM source-based code coverage
  • criterion - helps you write fast code by detecting and measuring performance improvements or regressions
  • cargo-udeps - find unused dependencies in Cargo.toml
  • cargo-audit - audit Cargo.lock files for crates with security vulnerabilities reported to the RustSec Advisory Database
  • cargo-upgrades - shows which dependencies in Cargo.toml can be upgraded to a newer version
  • cargo-unused-features- allows you to find and prune enabled, but, potentially unused feature flags from your project

Other recommended tools

  • kondo - save space by cleaning non-essential files from software projects. Finds and deletes target and node_modules folders
  • difftastic - a structural diff that understands syntax
  • cargo-hack - test each feature independently and all combinations of feature powerset
  • cargo-modules - plugin for showing an overview of a crate's modules
  • cargo-geiger - tool that lists statistics related to the usage of unsafe Rust code in a Rust crate and all its dependencies

TODO

  • template project to provide --bin and --lib versions in cargo-generate
  • add all commands from just thorough-check to CI
  • add choice of FOSS licences (MIT/APACHE/both/neither)
  • add comments to all of just commands
  • add confirmation for each of steps performed in just thorough-check
  • extend pre-commit-rust with all things in just pre-commit
  • investigate cargo-sync-readme
  • investigate rust-semverver/cargo-public-api/cargo-semver-checks
  • meta: speed up build-template CI run

Similar projects

You can find similar templates via cargo-generate topic on GitHub

License

This project is licensed under either of:

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Authors

Tomasz Karwowski LinkedIn

About

A template for your next Rust project.

Topics

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published