Skip to content

Fix clippy warnings and formatting across codebase#128

Open
e-desouza wants to merge 5 commits intomainfrom
fix/clippy-and-formatting
Open

Fix clippy warnings and formatting across codebase#128
e-desouza wants to merge 5 commits intomainfrom
fix/clippy-and-formatting

Conversation

@e-desouza
Copy link
Collaborator

High Level Overview of Change

  • Run cargo fmt across the entire codebase (30+ files had drifted)
  • Fix 17 non-result_large_err clippy warnings (lifetime syntax, deref_addrof, useless_conversion, len_zero, etc.)
  • Box large error variants in exception enums to resolve 40 result_large_err clippy warnings

Context of Change

The codebase had accumulated a number of clippy warnings and formatting inconsistencies over time. cargo fmt --check was failing on roughly 30 files, and cargo clippy --all-features -- -D warnings was producing 57 errors total (40 result_large_err, 17 assorted).

The result_large_err warnings were caused by several exception enums (XRPLCoreException, XRPLModelException, etc.) containing variants with large inline payloads. These are now Boxed to keep the Result type at a reasonable size on the stack. All From impls and match arms have been updated accordingly.

This is a prerequisite for the CI hardening PR that enforces -D warnings.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Refactor (non-breaking change that only restructures code)
  • Tests (You added tests for code that already exists, or your new feature included in this PR)
  • Documentation Updates
  • Release

Before / After

Before:

  • cargo fmt --check fails on ~30 files
  • cargo clippy --all-features -- -D warnings produces 57 errors

After:

  • cargo fmt --check passes cleanly
  • cargo clippy --all-features -- -D warnings passes with zero warnings
  • All existing tests continue to pass

Test Plan

cargo fmt --check
cargo clippy --all-features -- -D warnings
cargo test --all-features

All three pass with zero warnings and zero test failures.

Fixes import ordering, trailing whitespace in nftoken_mint.rs, and
other formatting inconsistencies across ~30 source files.
- Fix mismatched_lifetime_syntaxes: add explicit '_ to Cow<str>
- Fix deref_addrof: remove unnecessary & on already-reference args
- Fix useless_conversion: remove redundant .into() calls
- Fix len_zero: use .is_empty() instead of .len() > 0
- Fix cmp_owned: compare BigDecimal directly with integer literal
- Fix from_over_into: convert Into impl to From impl for Balance
- Fix is_multiple_of: use .is_multiple_of() instead of modulo
- Fix large_enum_variant: box ServerInfo and ServerState in XRPLResult
- Fix unreachable_code and remove #[allow] directives in asynch/mod.rs
Box XRPLWebSocketException inside XRPLClientException and box
ServerInfo/ServerState variants in XRPLResult to bring enum sizes
below the 128-byte clippy threshold.

This resolves all 40 clippy::result_large_err warnings, bringing the
codebase to zero clippy warnings under -D warnings.
- Replace deprecated actions-rs/* with dtolnay/rust-toolchain and
  direct cargo commands (actions-rs has been archived)
- Upgrade actions/checkout from v1/v2 to v4
- Add cargo fmt --check step to quality workflow
- Enforce -D warnings on clippy in CI and pre-commit hook
- Add rustfmt.toml with import ordering rules
- Change pre-commit hook to check formatting rather than auto-fix
- Fix duplicate "Build only core" step name (was building json-rpc)
@e-desouza e-desouza force-pushed the fix/clippy-and-formatting branch from de398b0 to aa53d7f Compare February 21, 2026 05:19
Modernize CI workflows and enforce strict linting
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.

1 participant