Enable additional clippy unsafe lints in SDK (Fixes #172)#356
Open
anand9125 wants to merge 2 commits intoanza-xyz:mainfrom
Open
Enable additional clippy unsafe lints in SDK (Fixes #172)#356anand9125 wants to merge 2 commits intoanza-xyz:mainfrom
anand9125 wants to merge 2 commits intoanza-xyz:mainfrom
Conversation
Author
|
Opened PR implementing the additional SDK clippy lints. Happy to revise if needed. |
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.
Fixes #172
Summary
Enables additional Clippy safety lints for the pinocchio SDK and updates the library code to satisfy them.
What was done
1. Clippy lints enabled (SDK only)
In
sdk/Cargo.toml, thepinocchiocrate now enables:clippy::undocumented_unsafe_blocks = "warn"clippy::multiple_unsafe_ops_per_block = "warn"2. SDK updated to satisfy lints
Added safety comments to unsafe blocks/impls across SDK modules:
Split blocks containing multiple unsafe operations where required
(notably in
instructions.rsandslot_hashes/mod.rs)Updated deprecated logic:
Rent::is_exemptnow usestry_minimum_balanceinstead ofminimum_balance3. Tests handling
Test-only code is excluded from these lints via module-level:
#![allow(clippy::undocumented_unsafe_blocks, clippy::multiple_unsafe_ops_per_block)]Applied in SDK test modules to keep lint enforcement focused on library code.
Scope
Lints are enabled only for the SDK (
pinocchiocrate).Program crates remain unchanged to keep this PR focused on the core library.
Verification
cargo test(full workspace) → passescargo +nightly-2025-02-16 clippy --workspace --all-targets --all-features --no-deps -- -D warnings→ passesNotes
No functional behavior changes intended.
This PR focuses on lint enforcement, safety documentation, and code clarity.