Skip to content

Commit 2a6b0a1

Browse files
authored
Merge pull request #946 from openmina/fix-clippy
Fix clippy lints for toolchain 1.83
2 parents dcc14aa + fcfd40a commit 2a6b0a1

File tree

22 files changed

+39
-38
lines changed

22 files changed

+39
-38
lines changed

.github/workflows/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
sudo apt install -y protobuf-compiler
1818
- uses: actions-rs/toolchain@v1
1919
with:
20-
toolchain: 1.81
20+
toolchain: 1.83
2121
components: rustfmt, clippy
2222
default: true
2323
- uses: actions-rs/cargo@v1

core/src/snark/snark_cmp.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ pub struct SnarkCmp<'a> {
1111
pub prover: &'a NonZeroCurvePoint,
1212
}
1313

14-
impl<'a> SnarkCmp<'a> {
14+
impl SnarkCmp<'_> {
1515
pub fn tie_breaker_hash(&self) -> [u8; 32] {
1616
super::tie_breaker_hash(&self.job_id, self.prover)
1717
}
1818
}
1919

20-
impl<'a> Ord for SnarkCmp<'a> {
20+
impl Ord for SnarkCmp<'_> {
2121
fn cmp(&self, other: &Self) -> std::cmp::Ordering {
2222
self.job_id
2323
.cmp(&other.job_id)
@@ -26,7 +26,7 @@ impl<'a> Ord for SnarkCmp<'a> {
2626
}
2727
}
2828

29-
impl<'a> PartialOrd for SnarkCmp<'a> {
29+
impl PartialOrd for SnarkCmp<'_> {
3030
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
3131
Some(self.cmp(other))
3232
}

ledger/src/generators/zkapp_command.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ use crate::{
4747

4848
use super::{Failure, NotPermitedOf, Role};
4949

50-
/// Value when we run `dune runtest src/lib/staged_ledger -f`
51-
//const ACCOUNT_CREATION_FEE: Fee = Fee::from_u64(1000000000);
50+
// /// Value when we run `dune runtest src/lib/staged_ledger -f`
51+
// const ACCOUNT_CREATION_FEE: Fee = Fee::from_u64(1000000000);
5252

5353
/// https://github.com/MinaProtocol/mina/blob/2ff0292b637684ce0372e7b8e23ec85404dc5091/src/lib/mina_generators/zkapp_command_generators.ml#L443
5454
fn gen_invalid_protocol_state_precondition(psv: &ProtocolStateView) -> ZkAppPreconditions {

ledger/src/ondisk/compression.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ pub enum MaybeCompressed<'a> {
33
No(&'a [u8]),
44
}
55

6-
impl<'a> AsRef<[u8]> for MaybeCompressed<'a> {
6+
impl AsRef<[u8]> for MaybeCompressed<'_> {
77
fn as_ref(&self) -> &[u8] {
88
match self {
99
MaybeCompressed::Compressed(c) => c,

ledger/src/proofs/block.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -636,7 +636,7 @@ mod vrf {
636636
delegator_bits: [bool; 35],
637637
}
638638

639-
impl<'a> ToInputs for Message<'a> {
639+
impl ToInputs for Message<'_> {
640640
fn to_inputs(&self, inputs: &mut Inputs) {
641641
let Self {
642642
global_slot,

ledger/src/proofs/wrap.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1848,7 +1848,8 @@ pub mod wrap_verifier {
18481848
pub const OPS_BITS_PER_CHUNK: usize = 5;
18491849

18501850
pub fn chunks_needed(num_bits: usize) -> usize {
1851-
(num_bits + (OPS_BITS_PER_CHUNK - 1)) / OPS_BITS_PER_CHUNK
1851+
// (num_bits + (OPS_BITS_PER_CHUNK - 1)) / OPS_BITS_PER_CHUNK
1852+
num_bits.div_ceil(OPS_BITS_PER_CHUNK)
18521853
}
18531854

18541855
fn lagrange_with_correction(

ledger/src/scan_state/parallel_scan.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ where
422422
Merge(&'a merge::Merge<M>),
423423
}
424424

425-
impl<'a, B, M> Debug for BaseOrMerge<'a, B, M>
425+
impl<B, M> Debug for BaseOrMerge<'_, B, M>
426426
where
427427
B: Debug,
428428
M: Debug,
@@ -818,7 +818,7 @@ pub struct JobValueWithIndex<'a> {
818818
pub job: JobValue<'a>,
819819
}
820820

821-
impl<'a> JobValueWithIndex<'a> {
821+
impl JobValueWithIndex<'_> {
822822
pub fn index(&self) -> usize {
823823
self.index
824824
}

ledger/src/scan_state/transaction_logic.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5428,10 +5428,10 @@ pub mod local_state {
54285428
}
54295429
}
54305430

5431-
/// NOTE: It looks like there are different instances of the polymorphic LocalEnv type
5432-
/// One with concrete types for the stack frame, call stack, and ledger. Created from the Env
5433-
/// And the other with their hashes. To differentiate them I renamed the first LocalStateEnv
5434-
/// Maybe a better solution is to keep the LocalState name and put it under a different module
5431+
// NOTE: It looks like there are different instances of the polymorphic LocalEnv type
5432+
// One with concrete types for the stack frame, call stack, and ledger. Created from the Env
5433+
// And the other with their hashes. To differentiate them I renamed the first LocalStateEnv
5434+
// Maybe a better solution is to keep the LocalState name and put it under a different module
54355435
// pub type LocalStateEnv<L> = LocalStateSkeleton<
54365436
// L, // ledger
54375437
// StackFrame, // stack_frame

ledger/src/staged_ledger/validate_block.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,8 @@ fn required_bitswap_block_count(max_block_size: usize, data_length: usize) -> us
185185
} else {
186186
let n1 = data_length - LINK_SIZE;
187187
let n2 = max_block_size - LINK_SIZE - 2;
188-
(n1 + n2 - 1) / n2
188+
// (n1 + n2 - 1) / n2
189+
n1.div_ceil(n2)
189190
}
190191
}
191192

ledger/src/util/backtrace.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ pub fn short_backtrace() -> String {
1616
.map(|sym| (sym.filename(), sym.name(), sym.lineno()))
1717
.enumerate()
1818
.filter(|(_, (filename, name, _))| {
19-
return !(filename
19+
!(filename
2020
.map(|filename| {
2121
filename.ends_with("ledger/src/util/backtrace.rs")
2222
|| filename
@@ -34,7 +34,7 @@ pub fn short_backtrace() -> String {
3434
|| name.starts_with("camlCamlinternalLazy__")
3535
|| name.starts_with("camlO1trace__") // This belongs to the mina repo, but useless to us
3636
})
37-
.unwrap_or(false));
37+
.unwrap_or(false))
3838
})
3939
.take_while(|(_, (_, name, _))| {
4040
name.as_ref().and_then(|n| n.as_str()) != Some("caml_program")

0 commit comments

Comments
 (0)