cargo +nightly fmt- formatcargo clippy -p trevm --all-features --all-targets- lint with featurescargo clippy -p trevm --no-default-features --all-targets- lint withoutcargo t -p trevm- test
Pre-push: clippy (both feature sets) + fmt. Never use cargo check/build.
A Claude hook in .claude/settings.json runs .claude/hooks/pre-push.sh
before every git push. The push is blocked if any check fails. The checks:
cargo +nightly fmt -- --checkcargo clippy -p trevm --all-targets --all-features -- -D warningscargo clippy -p trevm --all-targets --no-default-features -- -D warningsRUSTDOCFLAGS="-D warnings" cargo doc -p trevm --no-deps
Clippy and doc warnings are hard failures.
- Functional combinators over imperative control flow
let elsefor early returns, avoid nesting- No glob imports; group imports from same crate; no blank lines between imports
- Private by default,
pub(crate)for internal,pubfor API only; neverpub(super) thiserrorfor library errors, neveranyhoworeyrein library codetracingfor instrumentation: instrument work items not long-lived tasks;skip(self)on methods- Builders for structs with >4 fields or multiple same-type fields
- Tests: fail fast with
unwrap(), never returnResult; unit tests inmod tests - Rustdoc on all public items with usage examples; hide scaffolding with
# // SAFETY:comments on all unsafe blocks- Minimize generics in user-facing API; provide concrete types where possible
- Single library crate using the typestate pattern to enforce correct EVM usage at compile time
- State flow:
EvmNeedsCfg->EvmNeedsBlock->EvmNeedsTx->EvmReady->EvmTransacted - Extensive feature flags: test with both
--all-featuresand--no-default-features - Key features:
call,concurrent-db,estimate_gas,tracing-inspectors,alloy-db,test-utils - Uses
#[cfg_attr(docsrs, doc(cfg(...)))]for feature-gated documentation
Trevm uses semver. While pre-1.0, the MINOR version tracks revm's MAJOR
version (e.g. trevm 0.34.x targets revm 34.x.x). Breaking changes go
in PATCH versions to preserve this relationship, documented in GitHub
release notes. Always bump the patch version for breaking changes.