Skip to content

clippy: deny perf and redundant_clone lints#10121

Merged
nagisa merged 1 commit intoanza-xyz:masterfrom
nagisa:clippy-perf
Feb 25, 2026
Merged

clippy: deny perf and redundant_clone lints#10121
nagisa merged 1 commit intoanza-xyz:masterfrom
nagisa:clippy-perf

Conversation

@nagisa
Copy link
Copy Markdown

@nagisa nagisa commented Jan 20, 2026

Problem / Summary of Changes

I saw #10119 and figured that we might as well enable the perf related lints in our code to get less of these issues landed in the first place. Interestingly, though, this lint did not detect the exact problem in svm and I'm surprised there were no issues that clippy::perf flagged, so I'd be willing to drop that part of the PR.

@nagisa nagisa requested a review from a team as a code owner January 20, 2026 15:06
@nagisa nagisa force-pushed the clippy-perf branch 2 times, most recently from d69ed1d to 7bba583 Compare January 28, 2026 12:58
@nagisa nagisa requested a review from a team as a code owner January 28, 2026 12:58
@mergify
Copy link
Copy Markdown

mergify Bot commented Jan 28, 2026

The Firedancer team maintains a line-for-line reimplementation of the
native programs, and until native programs are moved to BPF, those
implementations must exactly match their Agave counterparts.
If this PR represents a change to a native program implementation (not
tests), please include a reviewer from the Firedancer team. And please
keep refactors to a minimum.

@LucasSte
Copy link
Copy Markdown

I believe this is a good change to have. @brooksprumo and @steviez would you mind having a look?

@nagisa I think you need to run cargo +nightly fmt --all to fix the lint errors in CI.

@brooksprumo
Copy link
Copy Markdown

I think you need to run cargo +nightly fmt --all to fix the lint errors in CI.

If you do not specify the same nightly version, then you may end up with different formatting and still fail CI. Here's the cmd you want:

cargo +nightly-2025-09-14 fmt --all -- --check

or what I do is run

./cargo nightly fmt

which uses the repo's cargo cmd and selects the correct nightly for you.

Copy link
Copy Markdown

@brooksprumo brooksprumo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Signing off for these files:

  • accounts-db/src/accounts.rs
  • core/tests/snapshots.rs
  • runtime/src/bank/accounts_lt_hash.rs
  • runtime/src/serde_snapshot.rs

And also the snapshot changes in core/src/validator.rs.

Comment thread Cargo.toml Outdated
Comment thread rust-toolchain.toml Outdated
Copy link
Copy Markdown

@steviez steviez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and figured that we might as well enable the perf related lints in our code to get less of these issues landed in the first place

Sounds great and agree with the direction. Same nit / question as Brooks; otherwise, I'll gradually review. Looks like you have a merge conflict in addition to the fmt issue that failed CI. I'll +1 Brooks' comment that I do the following to ensure I run the correct version

./cargo nightly fmt

Comment thread runtime/src/serde_snapshot.rs Outdated
Comment thread syscalls/src/lib.rs Outdated
@nagisa nagisa force-pushed the clippy-perf branch 4 times, most recently from 1df7442 to 8f1e4d0 Compare January 28, 2026 21:10
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Jan 28, 2026

Codecov Report

❌ Patch coverage is 96.15385% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.9%. Comparing base (2c5ff3c) to head (f5c2e65).

Additional details and impacted files
@@            Coverage Diff            @@
##           master   #10121     +/-   ##
=========================================
- Coverage    82.9%    82.9%   -0.1%     
=========================================
  Files         839      839             
  Lines      316033   316033             
=========================================
- Hits       262233   262226      -7     
- Misses      53800    53807      +7     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread program-runtime/src/serialization.rs Outdated
fn test_access_violation_handler() {
let program_id = Pubkey::new_unique();
let shared_account = AccountSharedData::new(0, 4, &program_id);
let shared_account_ref = shared_account.clone();
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On the surface, it isn't clear to me why creating shared_account_ref and then explicitly dropping later is required

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, fair enough. I'll think about how to express this in a more self-explanatory way...

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ended up keeping the original flow but added an explicit use of shared_account closer to the asserts to reinforce the shared nature of shared_account.

Comment thread core/src/banking_stage.rs
@alexpyattaev
Copy link
Copy Markdown

To move this from standstill, could we split this into smaller, more focused PRs which would not require multiple teams to approve?

@nagisa
Copy link
Copy Markdown
Author

nagisa commented Feb 12, 2026

Sure. I can do that… later.

nagisa added a commit to nagisa/agave that referenced this pull request Feb 12, 2026
These are detected by the `clippy::redundant_clone` lint which I hope to
deny by default in near future.

ref. anza-xyz#10121
nagisa added a commit to nagisa/agave that referenced this pull request Feb 12, 2026
These are detected by the `clippy::redundant_clone` lint which I hope to deny by default in near future.

ref. anza-xyz#10121
nagisa added a commit to nagisa/agave that referenced this pull request Feb 12, 2026
These are detected by the `clippy::redundant_clone` lint which I hope to deny by default in near future.

ref. anza-xyz#10121
nagisa added a commit to nagisa/agave that referenced this pull request Feb 12, 2026
These are detected by the `clippy::redundant_clone` lint which I hope to deny by default in near future.

ref. anza-xyz#10121
nagisa added a commit to nagisa/agave that referenced this pull request Feb 12, 2026
These are detected by the `clippy::redundant_clone` lint which I hope to
deny by default in near future.

ref. anza-xyz#10121
github-merge-queue Bot pushed a commit that referenced this pull request Feb 12, 2026
These are detected by the `clippy::redundant_clone` lint which I hope to
deny by default in near future.

ref. #10121
alexpyattaev pushed a commit to alexpyattaev/agave that referenced this pull request Feb 12, 2026
These are detected by the `clippy::redundant_clone` lint which I hope to deny by default in near future.

ref. anza-xyz#10121
@alexpyattaev alexpyattaev removed the request for review from a team February 13, 2026 08:08
mircea-c pushed a commit to mircea-c/svm that referenced this pull request Feb 23, 2026
These are detected by the `clippy::redundant_clone` lint which I hope to
deny by default in near future.

ref. anza-xyz/agave#10121
mircea-c pushed a commit to mircea-c/svm that referenced this pull request Feb 23, 2026
These are detected by the `clippy::redundant_clone` lint which I hope to
deny by default in near future.

ref. anza-xyz/agave#10121
mircea-c pushed a commit to mircea-c/svm that referenced this pull request Feb 23, 2026
These are detected by the `clippy::redundant_clone` lint which I hope to
deny by default in near future.

ref. anza-xyz/agave#10121
@nagisa
Copy link
Copy Markdown
Author

nagisa commented Feb 24, 2026

This for the most part has been whittled down to just core libraries and the vote program. I think this is now small enough that it should be fine to land with one approving reviewer.

Copy link
Copy Markdown

@steviez steviez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with @apfitzge's confirmation on that one point in banking_stage.rs

@nagisa nagisa added this pull request to the merge queue Feb 25, 2026
@nagisa
Copy link
Copy Markdown
Author

nagisa commented Feb 25, 2026

Double-checked just now that with master merged in the clippy passes so there should be no fallout.

Merged via the queue into anza-xyz:master with commit 020f7b1 Feb 25, 2026
51 checks passed
@nagisa nagisa deleted the clippy-perf branch February 25, 2026 13:17
mircea-c pushed a commit to mircea-c/svm that referenced this pull request Feb 25, 2026
These are detected by the `clippy::redundant_clone` lint which I hope to
deny by default in near future.

ref. anza-xyz/agave#10121
mircea-c pushed a commit to mircea-c/svm that referenced this pull request Feb 25, 2026
These are detected by the `clippy::redundant_clone` lint which I hope to
deny by default in near future.

ref. anza-xyz/agave#10121
mircea-c pushed a commit to mircea-c/svm that referenced this pull request Mar 6, 2026
These are detected by the `clippy::redundant_clone` lint which I hope to
deny by default in near future.

ref. anza-xyz/agave#10121
mircea-c pushed a commit to mircea-c/svm that referenced this pull request Mar 6, 2026
These are detected by the `clippy::redundant_clone` lint which I hope to
deny by default in near future.

ref. anza-xyz/agave#10121
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.

8 participants