Skip to content

Commit 727eafb

Browse files
authored
Merge pull request #1968 from o1-labs/io/1.92-fix-clippies
2 parents ea60235 + aadb6f6 commit 727eafb

File tree

23 files changed

+145
-126
lines changed

23 files changed

+145
-126
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3636
- **Docker compose files**: replace old environment by local in
3737
docker-compose.block-producer.yml
3838
([#1916](https://github.com/o1-labs/mina-rust/pull/1916)
39+
- **CI**: Remove clippy exceptions for large enum/err variants added
40+
as part of the Rust 1.92 upgrade
41+
[#1968](https://github.com/o1-labs/mina-rust/pull/1968)
3942

4043
### Changes
4144

Makefile

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -262,16 +262,12 @@ format-md: ## Format all markdown and MDX files to wrap at 80 characters
262262
.PHONY: lint
263263
lint: ## Run linter (clippy)
264264
cargo clippy --all-targets -- -D warnings \
265-
--allow clippy::large_enum_variant \
266-
--allow clippy::result-large-err \
267-
--allow unused
265+
--allow unused_assignments
268266

269267
.PHONY: lint-beta
270268
lint-beta: ## Run linter (clippy) using beta Rust
271269
cargo +beta clippy --all-targets -- -D warnings \
272-
--allow clippy::large_enum_variant \
273-
--allow clippy::result-large-err \
274-
--allow unused
270+
--allow unused_assignments
275271

276272
.PHONY: lint-bash
277273
lint-bash: ## Check all shell scripts using shellcheck

crates/cli/src/commands/misc.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use libp2p_identity::PeerId;
22
use mina_node::{account::AccountSecretKey, p2p::identity::SecretKey};
3-
use mina_node_account::AccountPublicKey;
43
use std::{fs::File, io::Write};
54

65
#[derive(Debug, clap::Args)]

crates/ledger/src/proofs/transaction.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4397,6 +4397,7 @@ pub(super) mod tests {
43974397

43984398
/// External worker input.
43994399
#[derive(Debug, BinProtRead, BinProtWrite)]
4400+
#[expect(clippy::large_enum_variant, reason = "This enum is only used in tests")]
44004401
pub enum ExternalSnarkWorkerRequest {
44014402
/// Queries worker for readiness, expected reply is `true`.
44024403
AwaitReadiness,

crates/ledger/src/scan_state/scan_state.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2142,7 +2142,10 @@ impl ScanState {
21422142
}
21432143
};
21442144

2145-
Ok(snark_work::spec::Work::Transition((statement, witness)))
2145+
Ok(snark_work::spec::Work::Transition((
2146+
statement,
2147+
Box::new(witness),
2148+
)))
21462149
}
21472150
Extracted::Second(s) => {
21482151
let merged = s.0.statement().merge(&s.1.statement())?;
@@ -2196,7 +2199,10 @@ impl ScanState {
21962199
}
21972200
};
21982201

2199-
Some(snark_work::spec::Work::Transition((statement, witness)))
2202+
Some(snark_work::spec::Work::Transition((
2203+
statement,
2204+
Box::new(witness),
2205+
)))
22002206
}
22012207
Extracted::Second(s) => {
22022208
let merged = s.0.statement().merge(&s.1.statement()).unwrap();

crates/ledger/src/scan_state/snark_work.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ pub mod spec {
55
};
66

77
pub enum Work {
8-
Transition((Box<Statement<()>>, TransactionWitness)),
8+
Transition((Box<Statement<()>>, Box<TransactionWitness>)),
99
Merge(Box<(Statement<()>, Box<(LedgerProof, LedgerProof)>)>),
1010
}
1111
}
@@ -30,6 +30,7 @@ mod tests {
3030

3131
/// External worker input.
3232
#[derive(Debug, BinProtRead, BinProtWrite)]
33+
#[expect(clippy::large_enum_variant, reason = "This enum is only used in tests")]
3334
pub enum ExternalSnarkWorkerRequest {
3435
/// Queries worker for readiness, expected reply is `true`.
3536
AwaitReadiness,

crates/node/src/event_source/event_source_actions.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ use serde::{Deserialize, Serialize};
33
pub type EventSourceActionWithMeta = redux::ActionWithMeta<EventSourceAction>;
44

55
#[derive(Serialize, Deserialize, Debug, Clone)]
6+
#[expect(clippy::large_enum_variant, reason = "This enum wraps super::Event")]
67
pub enum EventSourceAction {
78
/// Notify state machine that the new events might be received/available,
89
/// so trigger processing of those events.

crates/node/src/event_source/event_source_effects.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -261,10 +261,7 @@ pub fn event_source_effects<S: Service>(store: &mut Store<S>, action: EventSourc
261261
store.dispatch(P2pDisconnectionAction::Init { peer_id, reason });
262262
}
263263
Ok(message) => {
264-
store.dispatch(P2pChannelsMessageReceivedAction {
265-
peer_id,
266-
message: Box::new(message),
267-
});
264+
store.dispatch(P2pChannelsMessageReceivedAction { peer_id, message });
268265
}
269266
},
270267
P2pChannelEvent::Closed(peer_id, chan_id) => {
@@ -489,7 +486,9 @@ pub fn event_source_effects<S: Service>(store: &mut Store<S>, action: EventSourc
489486
Event::GenesisLoad(res) => match res {
490487
Err(err) => todo!("error while trying to load genesis config/ledger. - {err}"),
491488
Ok(data) => {
492-
store.dispatch(TransitionFrontierGenesisAction::LedgerLoadSuccess { data });
489+
store.dispatch(TransitionFrontierGenesisAction::LedgerLoadSuccess {
490+
data: Box::new(data),
491+
});
493492
}
494493
},
495494
},

crates/node/src/ledger/ledger_manager.rs

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,38 +22,48 @@ use std::collections::BTreeMap;
2222
/// can't be expressed in the Rust type system at the moment. For this
2323
/// reason this type is private while functions wrapping the whole call
2424
/// to the service are exposed as the service's methods.
25-
#[allow(dead_code)] // TODO
25+
#[expect(
26+
clippy::large_enum_variant,
27+
reason = "This is storing large messages, but size difference is only 2x between largest and second-largest variants"
28+
)]
2629
pub(super) enum LedgerRequest {
2730
Write(LedgerWriteRequest),
2831
Read(LedgerReadId, LedgerReadRequest),
32+
/// expected response: `LedgerHash`
2933
AccountsSet {
3034
snarked_ledger_hash: LedgerHash,
3135
parent: LedgerAddress,
3236
accounts: Vec<MinaBaseAccountBinableArgStableV2>,
33-
}, // expected response: LedgerHash
37+
},
38+
/// expected response: `Vec<Account>`
3439
AccountsGet {
3540
ledger_hash: LedgerHash,
3641
account_ids: Vec<AccountId>,
37-
}, // expected response: Vec<Account>
42+
},
43+
/// expected response: `ChildHashes`
3844
ChildHashesGet {
3945
snarked_ledger_hash: LedgerHash,
4046
parent: LedgerAddress,
41-
}, // expected response: ChildHashes
47+
},
48+
/// expected response: `Success`
4249
ComputeSnarkedLedgerHashes {
4350
snarked_ledger_hash: LedgerHash,
44-
}, // expected response: Success
51+
},
52+
/// expected response: `SnarkedLedgerContentsCopied`
4553
CopySnarkedLedgerContentsForSync {
4654
origin_snarked_ledger_hash: Vec<LedgerHash>,
4755
target_snarked_ledger_hash: LedgerHash,
4856
overwrite: bool,
49-
}, // expected response: SnarkedLedgerContentsCopied
57+
},
58+
/// expected response: `ProducersWithDelegatesMap`
5059
GetProducersWithDelegates {
5160
ledger_hash: LedgerHash,
5261
filter: fn(&CompressedPubKey) -> bool,
53-
}, // expected response: ProducersWithDelegatesMap
62+
},
63+
/// expected response: `LedgerMask`
5464
GetMask {
5565
ledger_hash: LedgerHash,
56-
}, // expected response: LedgerMask
66+
},
5767
InsertGenesisLedger {
5868
mask: Mask,
5969
},

crates/node/src/ledger/ledger_service.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1271,7 +1271,7 @@ impl LedgerCtx {
12711271
.view()
12721272
.map(|jobs| {
12731273
let jobs = jobs.collect::<Vec<JobValueWithIndex<'_>>>();
1274-
let mut iter = jobs.iter().peekable();
1274+
let iter = jobs.iter().peekable();
12751275
let mut res = Vec::with_capacity(jobs.len());
12761276

12771277
for job in iter {

0 commit comments

Comments
 (0)