Repository navigation
chore(contracts): enforce fmt + clippy CI gate and clear all lint/for… - #115
Merged
Merged
Conversation
…mat lapses Contracts CI previously ran only build + test — nothing guarded formatting or lints, so 91 rustfmt hunks and 27 clippy warnings had accumulated across all six contracts. This adds the missing gates and brings the tree clean so every future PR is held to the same bar. CI (.github/workflows/contracts-ci.yml): - Add `cargo fmt --all --check` (fast fail, before any compile). - Add `cargo clippy --workspace --all-targets -- -D warnings`, placed after the dependency-WASM build so creditline's contractimport! clients resolve during the native clippy compile (otherwise E0599 on receive_guarantee). - Install rustfmt + clippy toolchain components. Formatting: - Apply rustfmt across all six contracts. Lint fixes (clippy -D warnings now clean): - Replace `assert_eq!(x, <bool>)` with `assert!` in liquidity-pool and creditline tests (10). - Use `saturating_add` in place of `checked_add(..).unwrap_or(u64::MAX)` in vouching TTL math — behaviour-identical (2). - Use `matches!` in place of match-to-bool in creditline reputation-call handling (2). - Remove unused `Val`/`Vec` imports, an unused `mut`, an unused `registry` binding; add an elided lifetime; fix a rustdoc list-item indentation. - Remove the dead `safe_math` modules from parameters and vendor-registry: both already perform overflow-checked arithmetic inline, so no safety is lost. creditline, liquidity-pool and reputation keep their used copies. - Remove an unused `assert_event` test helper. Test quality: - Add the missing `share_price_before == 10_000` baseline assertion in the creditline default-loss test (the value was captured but never checked). Verified: fmt clean, clippy -D warnings clean, all contracts build for wasm32-unknown-unknown (release), 420 tests pass. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.