Repository navigation
Fix all clippy warnings and improve code quality - #24
Merged
Merged
Conversation
This commit resolves all clippy warnings and improves code quality across the codebase: - Replace deprecated methods (SecretKey::from_slice, rng.gen, numeric max_value) - Use idiomatic Rust patterns (matches! macro, if let, for loops) - Fix function signatures (&Vec<u8> → &[u8], &String → &str) - Add missing is_empty() method to ByteSequence - Change AtomicU64 constants to static items - Fix documentation formatting - Remove needless borrows and unnecessary operations - Use proper assertion patterns in tests All changes follow Rust best practices and idioms. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Coverage summary from CodacySee diff coverage on Codacy
Coverage variation details
Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: Diff coverage details
Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: See your quality gate settings Change summary preferences |
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.
Summary
This PR resolves all clippy warnings and improves code quality across the codebase:
Key Changes
Deprecated API Updates:
SecretKey::from_slicewithSecretKey::from_byte_arrayrng.gen()withrng.random()u16::max_value()→u16::MAX, etc.)Idiomatic Rust Patterns:
matches!macro instead of verbose match expressionsmatchstatements toif letpatternswhile letloops withforloops where appropriateRangeInclusive::containsAPI Improvements:
&Vec<u8>to&[u8]for better performance&Stringto&strfor string parametersis_empty()method toByteSequencestructAtomicU64constants to static items (correct for interior mutability)Code Cleanup:
assert!vsassert_eq!(x, true))assert!(false)with descriptivepanic!messagesFiles Modified (17 files, +104/-78 lines)
bsv/src/bitcoin/address.rsbsv/src/bitcoin/base58ck.rsbsv/src/bitcoin/block.rsbsv/src/bitcoin/crypto.rsbsv/src/bitcoin/hash.rsbsv/src/bitcoin/merkle.rsbsv/src/bitcoin/proptest_tests.rsbsv/src/bitcoin/rules.rsbsv/src/bitcoin/script/byte_seq.rsbsv/src/bitcoin/script/interpreter.rsbsv/src/bitcoin/script/op.rsbsv/src/bitcoin/script/signature.rsbsv/src/bitcoin/tx.rsbsv/src/bitcoin/var_int.rsbsv/src/bitcoin/var_int_edge_tests.rsbsv/src/lib.rsbsv/src/p2p/protocol.rsTest plan
cargo fmtcargo clippy)All changes follow Rust best practices and idioms. The code is more maintainable and follows current Rust conventions.
🤖 Generated with Claude Code