Skip to content

fix(ci): resolve compile errors blocking pedantic clippy from completing - #1072

Merged
robertocarlous merged 1 commit into
Neurowealth:mainfrom
ElizabethChi:fix/neurowealth-elizabeth-762-pedantic-clippy
Oct 20, 2026
Merged

robertocarlous merged 1 commit into
Neurowealth:mainfrom
ElizabethChi:fix/neurowealth-elizabeth-762-pedantic-clippy

Conversation

@ElizabethChi

Copy link
Copy Markdown
Contributor

closes #762

What's actually going on

The "Clippy Lint" job in .github/workflows/ci.yml already runs:

cargo clippy --all-targets --all-features -- -D warnings -D clippy::all -D clippy::pedantic

So pedantic clippy and warnings-as-errors is already enabled in CI config. The problem is the check currently can't finish: share-math fails to compile under clippy::all itself (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) triggers clippy::chunks_exact_to_as_chunks, which -D clippy::all makes a hard error. Switched to as_chunks::<4>() (stable since Rust 1.88, no nightly feature needed).
  • lib.rs: a panic path referenced VaultError::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: both should_panic(expected = "Error(Contract, #86)") assertions were asserting the wrong code (Reject negative cap values in all limit setters #86 is InvalidRateLimitConfig, unrelated). Updated to #93 to match the variant above. Also fixed entries.push(...) to entries.push_back(...) in the same file (soroban_sdk::Vec has no push method), a separate pre-existing compile error in the same test.
  • lib.rs: removed two needless mut bindings that -D warnings promotes to hard errors.

Disclosure

With those 3 compile errors fixed, clippy runs to completion on the vault crate and surfaces 371 real clippy::pedantic findings (182 pass-by-value params, 75 missing #[must_use], 57 missing doc backticks, plus smaller categories: casts expressible via From, 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-targets still fails to compile on a fresh clone of main (about a dozen errors, mostly test call sites passing an extra owner/auth argument to vault setters like set_max_decrease_bps/set_min_holding_period whose current signatures don't take one, plus a missing Ledger::set_sequence).
  • cargo fmt --all -- --check has pre-existing unrelated drift in tests/mod.rs (alphabetical mod ordering), present on a clean clone of main too.

Verified: cargo clippy -p share-math --all-features -- -D warnings -D clippy::all -D clippy::pedantic is 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").

…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.
@robertocarlous
robertocarlous merged commit 04778c1 into Neurowealth:main Oct 20, 2026
0 of 2 checks passed
AminMG044 pushed a commit to AminMG044/NeuroWealth-Smartcontract that referenced this pull request Nov 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

security: enable pedantic clippy and warnings-as-errors in the contract CI

2 participants