Skip to content

Commit 3c8fa58

Browse files
Merge branch 'matthias/clippy-and-warnings' into matthias/s-box-7
2 parents e6c74ea + 9442f47 commit 3c8fa58

File tree

13 files changed

+204
-251
lines changed

13 files changed

+204
-251
lines changed

circ_blocks/examples/zxc.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ use libspartan::{
3333
use merlin::Transcript;
3434
use serde::{Deserialize, Serialize};
3535
use std::time::*;
36-
use std::time::*;
3736

3837
// How many reserved variables (EXCLUDING V) are in front of the actual input / output?
3938
// %BN, %RET, %TS, %AS, %SP, %BP

ff/ff_derive/src/lib.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,7 @@ impl ReprEndianness {
3535
match self {
3636
ReprEndianness::Big => {
3737
let buf = modulus.to_bytes_be();
38-
iter::repeat(0)
39-
.take(bytes - buf.len())
40-
.chain(buf.into_iter())
41-
.collect()
38+
iter::repeat(0).take(bytes - buf.len()).chain(buf).collect()
4239
}
4340
ReprEndianness::Little => {
4441
let mut buf = modulus.to_bytes_le();

spartan_parallel/src/custom_dense_mlpoly.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ pub fn rev_bits(q: usize, max_num_proofs: usize) -> usize {
3535
(0..max_num_proofs.log_2())
3636
.rev()
3737
.map(|i| q / (i.pow2()) % 2 * (max_num_proofs / i.pow2() / 2))
38-
.fold(0, |a, b| a + b)
38+
.sum::<usize>()
3939
}
4040

4141
impl<S: SpartanExtensionField> DensePolynomialPqx<S> {
@@ -112,7 +112,7 @@ impl<S: SpartanExtensionField> DensePolynomialPqx<S> {
112112
}
113113

114114
pub fn len(&self) -> usize {
115-
return self.num_instances * self.max_num_proofs * self.max_num_inputs;
115+
self.num_instances * self.max_num_proofs * self.max_num_inputs
116116
}
117117

118118
// Given (p, q_rev, x_rev) return Z[p][q_rev][x_rev]
@@ -122,9 +122,9 @@ impl<S: SpartanExtensionField> DensePolynomialPqx<S> {
122122
&& w < self.Z[p][q_rev].len()
123123
&& x_rev < self.Z[p][q_rev][w].len()
124124
{
125-
return self.Z[p][q_rev][w][x_rev];
125+
self.Z[p][q_rev][w][x_rev]
126126
} else {
127-
return S::field_zero();
127+
S::field_zero()
128128
}
129129
}
130130

@@ -138,31 +138,31 @@ impl<S: SpartanExtensionField> DensePolynomialPqx<S> {
138138
match mode {
139139
MODE_P => {
140140
if p + self.num_instances / 2 < self.Z.len() {
141-
return self.Z[p + self.num_instances / 2][q_rev][w][x_rev];
141+
self.Z[p + self.num_instances / 2][q_rev][w][x_rev]
142142
} else {
143-
return S::field_zero();
143+
S::field_zero()
144144
}
145145
}
146146
MODE_Q => {
147-
return if self.num_proofs[p] == 1 {
147+
if self.num_proofs[p] == 1 {
148148
S::field_zero()
149149
} else {
150150
self.Z[p][q_rev + self.num_proofs[p] / 2][w][x_rev]
151-
};
151+
}
152152
}
153153
MODE_W => {
154154
if w + self.num_witness_secs / 2 < self.Z[p][q_rev].len() {
155-
return self.Z[p][q_rev][w + self.num_witness_secs / 2][x_rev];
155+
self.Z[p][q_rev][w + self.num_witness_secs / 2][x_rev]
156156
} else {
157-
return S::field_zero();
157+
S::field_zero()
158158
}
159159
}
160160
MODE_X => {
161-
return if self.num_inputs[p] == 1 {
161+
if self.num_inputs[p] == 1 {
162162
S::field_zero()
163163
} else {
164164
self.Z[p][q_rev][w][x_rev + self.num_inputs[p] / 2]
165-
};
165+
}
166166
}
167167
_ => {
168168
panic!(

spartan_parallel/src/dense_mlpoly.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,9 @@ use crate::scalar::SpartanExtensionField;
44
use super::errors::ProofVerifyError;
55
use super::math::Math;
66
use super::random::RandomTape;
7-
use super::transcript::ProofTranscript;
87
use core::ops::Index;
98
use merlin::Transcript;
109
use serde::{Deserialize, Serialize};
11-
use std::collections::HashMap;
1210

1311
#[cfg(feature = "multicore")]
1412
use rayon::prelude::*;

spartan_parallel/src/instance.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ impl<S: SpartanExtensionField> Instance<S> {
165165
Vec<(usize, usize, [u8; 32])>,
166166
) {
167167
let int_to_scalar = |i: isize| {
168-
let abs_scalar = S::from(i.abs() as u64);
168+
let abs_scalar = S::from(i.unsigned_abs() as u64);
169169
if i < 0 {
170170
abs_scalar.negate().to_bytes()
171171
} else {
@@ -1043,7 +1043,7 @@ impl<S: SpartanExtensionField> Instance<S> {
10431043
println!("Total Cons Exec Size: {}", total_cons_exec_size);
10441044
}
10451045

1046-
let pairwise_check_inst = Instance::new(
1046+
Instance::new(
10471047
3,
10481048
pairwise_check_max_num_cons,
10491049
pairwise_check_num_cons,
@@ -1052,8 +1052,7 @@ impl<S: SpartanExtensionField> Instance<S> {
10521052
&B_list,
10531053
&C_list,
10541054
)
1055-
.unwrap();
1056-
pairwise_check_inst
1055+
.unwrap()
10571056
};
10581057
(
10591058
pairwise_check_num_vars,
@@ -1294,7 +1293,7 @@ impl<S: SpartanExtensionField> Instance<S> {
12941293
println!("Total Cons Exec Size: {}", total_cons_exec_size);
12951294
}
12961295

1297-
let perm_root_inst = Instance::new(
1296+
Instance::new(
12981297
1,
12991298
perm_root_num_cons,
13001299
vec![perm_root_num_cons],
@@ -1303,8 +1302,7 @@ impl<S: SpartanExtensionField> Instance<S> {
13031302
&B_list,
13041303
&C_list,
13051304
)
1306-
.unwrap();
1307-
perm_root_inst
1305+
.unwrap()
13081306
};
13091307
(
13101308
perm_root_num_cons,

0 commit comments

Comments
 (0)