Fix clippy warnings and formatting across codebase#128
Open
Fix clippy warnings and formatting across codebase#128
Conversation
7 tasks
63a5212 to
de398b0
Compare
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)
de398b0 to
aa53d7f
Compare
Modernize CI workflows and enforce strict linting
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.
High Level Overview of Change
cargo fmtacross the entire codebase (30+ files had drifted)result_large_errclippy warnings (lifetime syntax, deref_addrof, useless_conversion, len_zero, etc.)result_large_errclippy warningsContext of Change
The codebase had accumulated a number of clippy warnings and formatting inconsistencies over time.
cargo fmt --checkwas failing on roughly 30 files, andcargo clippy --all-features -- -D warningswas producing 57 errors total (40result_large_err, 17 assorted).The
result_large_errwarnings were caused by several exception enums (XRPLCoreException,XRPLModelException, etc.) containing variants with large inline payloads. These are nowBoxed to keep theResulttype at a reasonable size on the stack. AllFromimpls and match arms have been updated accordingly.This is a prerequisite for the CI hardening PR that enforces
-D warnings.Type of Change
Before / After
Before:
cargo fmt --checkfails on ~30 filescargo clippy --all-features -- -D warningsproduces 57 errorsAfter:
cargo fmt --checkpasses cleanlycargo clippy --all-features -- -D warningspasses with zero warningsTest Plan
cargo fmt --check cargo clippy --all-features -- -D warnings cargo test --all-featuresAll three pass with zero warnings and zero test failures.