Repository navigation
fix(ci): resolve compile errors blocking pedantic clippy from completing - #1072
Merged
robertocarlous merged 1 commit intoOct 20, 2026
Conversation
…Neurowealth#762) The CI matrix already runs cargo clippy --all-targets --all-features with -D warnings -D clippy::all -D clippy::pedantic on this workspace (.github/workflows/ci.yml), but the check currently cannot complete: share-math fails to even compile under clippy::all (a chunks_exact call that clippy flags as a hard error, not a lint), and the main vault crate has 3 real compile errors once that's past: a panic referencing a VaultError variant (DepositRejectedZeroAssetsWithShares, Neurowealth#973) that was never added to the enum, and two needless mut bindings that -D warnings promotes to errors. Fixes: - share-math/src/queue.rs: chunks_exact(4) to as_chunks::<4>() (stable since Rust 1.88, no nightly feature needed) - Added the missing VaultError variant at the next free discriminant (93); updated its two should_panic test assertions, which were hardcoded to Neurowealth#86 (an unrelated pre-existing variant), to Neurowealth#93 - Also fixed entries.push(...) to entries.push_back(...) in the same test file: soroban_sdk::Vec has no push method, so this was a separate pre-existing compile error in the same Neurowealth#973 test - Removed two needless mut bindings in lib.rs flagged by -D warnings Disclosure: with these 3 compile errors out of the way, clippy now runs to completion on the full vault crate and reports 371 real clippy::pedantic findings (182 pass-by-value, 75 missing #[must_use], 57 missing doc backticks, and smaller categories). That is a much larger, separate cleanup than this issue's literal scope (the CI config already correctly enables the check); not attempted here. Also out of scope and not touched: cargo test --all-targets still fails to compile (about a dozen unrelated errors, mostly test call sites passing an extra owner/auth argument to vault setters whose signatures no longer take one), and the pre-existing tests/mod.rs module-ordering drift that cargo fmt wants to rewrite on an unrelated set of lines.
AminMG044
pushed a commit
to AminMG044/NeuroWealth-Smartcontract
that referenced
this pull request
Nov 10, 2026
…-elizabeth-762-pedantic-clippy
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.
closes #762
What's actually going on
The "Clippy Lint" job in
.github/workflows/ci.ymlalready runs:So pedantic clippy and warnings-as-errors is already enabled in CI config. The problem is the check currently can't finish:
share-mathfails to compile underclippy::allitself (not just a pedantic nit), and once that's past, the main vault crate has 3 real compile errors that block clippy from reaching the pedantic lint pass at all.Fixes
share-math/src/queue.rs:chunks_exact(4)triggersclippy::chunks_exact_to_as_chunks, which-D clippy::allmakes a hard error. Switched toas_chunks::<4>()(stable since Rust 1.88, no nightly feature needed).lib.rs: a panic path referencedVaultError::DepositRejectedZeroAssetsWithShares(added for security(contract): convert_to_shares mints 1:1 when TotalShares > 0 but TotalAssets == 0 #973's zero-assets-with-shares protection), but the variant was never added to the enum. Added it at the next free discriminant (93).test_zero_assets_with_shares.rs: bothshould_panic(expected = "Error(Contract, #86)")assertions were asserting the wrong code (Reject negative cap values in all limit setters #86 isInvalidRateLimitConfig, unrelated). Updated to#93to match the variant above. Also fixedentries.push(...)toentries.push_back(...)in the same file (soroban_sdk::Vechas nopushmethod), a separate pre-existing compile error in the same test.lib.rs: removed two needlessmutbindings that-D warningspromotes to hard errors.Disclosure
With those 3 compile errors fixed, clippy runs to completion on the vault crate and surfaces 371 real
clippy::pedanticfindings (182 pass-by-value params, 75 missing#[must_use], 57 missing doc backticks, plus smaller categories: casts expressible viaFrom, functions over the line-length lint, etc.). That's a large, separate cleanup effort, not something this PR attempts. The issue's literal scope (enabling the check) is already done in CI config; what was missing was just getting the build to a state where the check can run.Also confirmed but not touched here (separate, unrelated to #762):
cargo test --all-targetsstill fails to compile on a fresh clone ofmain(about a dozen errors, mostly test call sites passing an extra owner/auth argument to vault setters likeset_max_decrease_bps/set_min_holding_periodwhose current signatures don't take one, plus a missingLedger::set_sequence).cargo fmt --all -- --checkhas pre-existing unrelated drift intests/mod.rs(alphabetical mod ordering), present on a clean clone ofmaintoo.Verified:
cargo clippy -p share-math --all-features -- -D warnings -D clippy::all -D clippy::pedanticis now fully clean.cargo clippy --all-features(lib only, not--all-targets) on the vault crate now compiles and runs to completion (371 pedantic findings, down from "doesn't compile").