-
Notifications
You must be signed in to change notification settings - Fork 41
Fix more 1.92 Clippies #1968
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Fix more 1.92 Clippies #1968
Changes from all commits
8822d27
8403a8d
d49da27
c5b4a2a
02c5285
f50f4e9
ba9151c
3b0a2e3
7292ed2
1d42af3
301308f
ac0b3c8
8d814e1
b6478e1
0f85bf3
5d23d02
db82285
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4397,6 +4397,7 @@ pub(super) mod tests { | |
|
|
||
| /// External worker input. | ||
| #[derive(Debug, BinProtRead, BinProtWrite)] | ||
| #[expect(clippy::large_enum_variant, reason = "This enum is only used in tests")] | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should put this behind a feature flag if it's only used in tests
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't need to change in this PR, but can you create an issue before resolving the comment? |
||
| pub enum ExternalSnarkWorkerRequest { | ||
| /// Queries worker for readiness, expected reply is `true`. | ||
| AwaitReadiness, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2142,7 +2142,10 @@ impl ScanState { | |
| } | ||
| }; | ||
|
|
||
| Ok(snark_work::spec::Work::Transition((statement, witness))) | ||
| Ok(snark_work::spec::Work::Transition(( | ||
| statement, | ||
| Box::new(witness), | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Curious to hear your opinion on this, but when it comes to wrapper types like this, I prefer to use (not a change for this PR, just interested in your thoughts) |
||
| ))) | ||
| } | ||
| Extracted::Second(s) => { | ||
| let merged = s.0.statement().merge(&s.1.statement())?; | ||
|
|
@@ -2196,7 +2199,10 @@ impl ScanState { | |
| } | ||
| }; | ||
|
|
||
| Some(snark_work::spec::Work::Transition((statement, witness))) | ||
| Some(snark_work::spec::Work::Transition(( | ||
| statement, | ||
| Box::new(witness), | ||
| ))) | ||
| } | ||
| Extracted::Second(s) => { | ||
| let merged = s.0.statement().merge(&s.1.statement()).unwrap(); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,7 +5,7 @@ pub mod spec { | |
| }; | ||
|
|
||
| pub enum Work { | ||
| Transition((Box<Statement<()>>, TransactionWitness)), | ||
| Transition((Box<Statement<()>>, Box<TransactionWitness>)), | ||
| Merge(Box<(Statement<()>, Box<(LedgerProof, LedgerProof)>)>), | ||
| } | ||
| } | ||
|
|
@@ -30,6 +30,7 @@ mod tests { | |
|
|
||
| /// External worker input. | ||
| #[derive(Debug, BinProtRead, BinProtWrite)] | ||
| #[expect(clippy::large_enum_variant, reason = "This enum is only used in tests")] | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same comment |
||
| pub enum ExternalSnarkWorkerRequest { | ||
| /// Queries worker for readiness, expected reply is `true`. | ||
| AwaitReadiness, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,6 +3,7 @@ use serde::{Deserialize, Serialize}; | |
| pub type EventSourceActionWithMeta = redux::ActionWithMeta<EventSourceAction>; | ||
|
|
||
| #[derive(Serialize, Deserialize, Debug, Clone)] | ||
| #[expect(clippy::large_enum_variant, reason = "This enum extends super::Event")] | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🤔 I'm not sure if I agree with this one. This should almost certainly be boxed, no? Also... a nit... but... I would say "wraps," not "extends" |
||
| pub enum EventSourceAction { | ||
| /// Notify state machine that the new events might be received/available, | ||
| /// so trigger processing of those events. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -261,10 +261,7 @@ pub fn event_source_effects<S: Service>(store: &mut Store<S>, action: EventSourc | |
| store.dispatch(P2pDisconnectionAction::Init { peer_id, reason }); | ||
| } | ||
| Ok(message) => { | ||
| store.dispatch(P2pChannelsMessageReceivedAction { | ||
| peer_id, | ||
| message: Box::new(message), | ||
| }); | ||
| store.dispatch(P2pChannelsMessageReceivedAction { peer_id, message }); | ||
| } | ||
| }, | ||
| P2pChannelEvent::Closed(peer_id, chan_id) => { | ||
|
|
@@ -489,7 +486,9 @@ pub fn event_source_effects<S: Service>(store: &mut Store<S>, action: EventSourc | |
| Event::GenesisLoad(res) => match res { | ||
| Err(err) => todo!("error while trying to load genesis config/ledger. - {err}"), | ||
| Ok(data) => { | ||
| store.dispatch(TransitionFrontierGenesisAction::LedgerLoadSuccess { data }); | ||
| store.dispatch(TransitionFrontierGenesisAction::LedgerLoadSuccess { | ||
| data: Box::new(data), | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Again, this is one of those places where I would use |
||
| }); | ||
| } | ||
| }, | ||
| }, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,38 +22,48 @@ use std::collections::BTreeMap; | |
| /// can't be expressed in the Rust type system at the moment. For this | ||
| /// reason this type is private while functions wrapping the whole call | ||
| /// to the service are exposed as the service's methods. | ||
| #[allow(dead_code)] // TODO | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 😳 |
||
| #[expect( | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| clippy::large_enum_variant, | ||
| reason = "This is storing large messages, but size difference is only 2x between largest and second-largest variants" | ||
| )] | ||
| pub(super) enum LedgerRequest { | ||
| Write(LedgerWriteRequest), | ||
| Read(LedgerReadId, LedgerReadRequest), | ||
| /// expected response: `LedgerHash` | ||
| AccountsSet { | ||
| snarked_ledger_hash: LedgerHash, | ||
| parent: LedgerAddress, | ||
| accounts: Vec<MinaBaseAccountBinableArgStableV2>, | ||
| }, // expected response: LedgerHash | ||
| }, | ||
| /// expected response: `Vec<Account>` | ||
| AccountsGet { | ||
| ledger_hash: LedgerHash, | ||
| account_ids: Vec<AccountId>, | ||
| }, // expected response: Vec<Account> | ||
| }, | ||
| /// expected response: `ChildHashes` | ||
| ChildHashesGet { | ||
| snarked_ledger_hash: LedgerHash, | ||
| parent: LedgerAddress, | ||
| }, // expected response: ChildHashes | ||
| }, | ||
| /// expected response: `Success` | ||
| ComputeSnarkedLedgerHashes { | ||
| snarked_ledger_hash: LedgerHash, | ||
| }, // expected response: Success | ||
| }, | ||
| /// expected response: `SnarkedLedgerContentsCopied` | ||
| CopySnarkedLedgerContentsForSync { | ||
| origin_snarked_ledger_hash: Vec<LedgerHash>, | ||
| target_snarked_ledger_hash: LedgerHash, | ||
| overwrite: bool, | ||
| }, // expected response: SnarkedLedgerContentsCopied | ||
| }, | ||
| /// expected response: `ProducersWithDelegatesMap` | ||
| GetProducersWithDelegates { | ||
| ledger_hash: LedgerHash, | ||
| filter: fn(&CompressedPubKey) -> bool, | ||
| }, // expected response: ProducersWithDelegatesMap | ||
| }, | ||
| /// expected response: `LedgerMask` | ||
| GetMask { | ||
| ledger_hash: LedgerHash, | ||
| }, // expected response: LedgerMask | ||
| }, | ||
| InsertGenesisLedger { | ||
| mask: Mask, | ||
| }, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1271,7 +1271,7 @@ impl LedgerCtx { | |
| .view() | ||
| .map(|jobs| { | ||
| let jobs = jobs.collect::<Vec<JobValueWithIndex<'_>>>(); | ||
| let mut iter = jobs.iter().peekable(); | ||
| let iter = jobs.iter().peekable(); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 😎 |
||
| let mut res = Vec::with_capacity(jobs.len()); | ||
|
|
||
| for job in iter { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -45,7 +45,7 @@ impl TransitionFrontierGenesisState { | |
| TransitionFrontierGenesisAction::LedgerLoadSuccess { data } => { | ||
| *state = Self::LedgerLoadSuccess { | ||
| time: meta.time(), | ||
| data: data.clone(), | ||
| data: *data.clone(), | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Really!?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah nvm... |
||
| }; | ||
|
|
||
| // Dispatch | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh no... for the whole thing!?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(I actually don't know the difference between
unused_assignmentsvsunused)