Skip to content

Commit 55f0f95

Browse files
committed
fix clippy for new rust version (#1013)
1 parent ebdf8cd commit 55f0f95

File tree

27 files changed

+75
-91
lines changed

27 files changed

+75
-91
lines changed

benches/benches/add.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ pub fn criterion_benchmark(c: &mut Criterion) {
1515
// arkworks-ff
1616
{
1717
c.bench_function(
18-
&format!("{} 1M elements | ark-ff - ef8f758", BENCHMARK_NAME),
18+
&format!("{BENCHMARK_NAME} 1M elements | ark-ff - ef8f758"),
1919
|b| {
2020
b.iter(|| {
2121
let mut iter = arkworks_vec.iter();
@@ -35,7 +35,7 @@ pub fn criterion_benchmark(c: &mut Criterion) {
3535
let lambdaworks_vec = to_lambdaworks_vec(&arkworks_vec);
3636

3737
c.bench_function(
38-
&format!("{} 1M elements | lambdaworks", BENCHMARK_NAME,),
38+
&format!("{BENCHMARK_NAME} 1M elements | lambdaworks",),
3939
|b| {
4040
b.iter(|| {
4141
let mut iter = lambdaworks_vec.iter();

benches/benches/invert.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ pub fn criterion_benchmark(c: &mut Criterion) {
1414
// arkworks-ff
1515
{
1616
c.bench_function(
17-
&format!("{} 10000 elements| ark-ff - ef8f758", BENCHMARK_NAME),
17+
&format!("{BENCHMARK_NAME} 10000 elements| ark-ff - ef8f758"),
1818
|b| {
1919
b.iter_batched(
2020
|| arkworks_vec.clone(),
@@ -34,7 +34,7 @@ pub fn criterion_benchmark(c: &mut Criterion) {
3434
let lambdaworks_vec = to_lambdaworks_vec(&arkworks_vec);
3535

3636
c.bench_function(
37-
&format!("{} 10000 elements | lambdaworks", BENCHMARK_NAME,),
37+
&format!("{BENCHMARK_NAME} 10000 elements | lambdaworks",),
3838
|b| {
3939
b.iter(|| {
4040
for elem in lambdaworks_vec.iter() {

benches/benches/mul.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,7 @@ pub fn criterion_benchmark(c: &mut Criterion) {
1414
// arkworks-ff
1515
{
1616
c.bench_function(
17-
&format!(
18-
"{} 10K elements | ark-ff - commit: ef8f758 ",
19-
BENCHMARK_NAME
20-
),
17+
&format!("{BENCHMARK_NAME} 10K elements | ark-ff - commit: ef8f758 "),
2118
|b| {
2219
b.iter(|| {
2320
let mut iter = arkworks_vec.iter();
@@ -37,7 +34,7 @@ pub fn criterion_benchmark(c: &mut Criterion) {
3734
let lambdaworks_vec = to_lambdaworks_vec(&arkworks_vec);
3835

3936
c.bench_function(
40-
&format!("{} 10K elements | lambdaworks", BENCHMARK_NAME,),
37+
&format!("{BENCHMARK_NAME} 10K elements | lambdaworks",),
4138
|b| {
4239
b.iter(|| {
4340
let mut iter = lambdaworks_vec.iter();

benches/benches/point.rs

Lines changed: 20 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ pub fn point_double_projective(c: &mut Criterion) {
1616

1717
{
1818
c.bench_function(
19-
&format!("{} Projective Double | Starknet RS ", BENCHMARK_NAME),
19+
&format!("{BENCHMARK_NAME} Projective Double | Starknet RS "),
2020
|b| {
2121
b.iter(|| {
2222
let mut initial_point = starknet_rs_projective_generator;
@@ -41,7 +41,7 @@ pub fn point_double_projective(c: &mut Criterion) {
4141

4242
{
4343
c.bench_function(
44-
&format!("{} Projective Double | Lambdaworks", BENCHMARK_NAME),
44+
&format!("{BENCHMARK_NAME} Projective Double | Lambdaworks"),
4545
|b| {
4646
b.iter(|| {
4747
lambdaworks_affine_generator
@@ -71,10 +71,7 @@ pub fn point_add_projective_affine(c: &mut Criterion) {
7171

7272
{
7373
c.bench_function(
74-
&format!(
75-
"{} 10k Add Projective-Affine | Starknet RS ",
76-
BENCHMARK_NAME
77-
),
74+
&format!("{BENCHMARK_NAME} 10k Add Projective-Affine | Starknet RS "),
7875
|b| {
7976
b.iter(|| {
8077
let mut projective_point_rs = starknet_rs_initial_projective;
@@ -93,9 +90,9 @@ pub fn point_add_projective_affine(c: &mut Criterion) {
9390
}
9491

9592
let starknet_rs_x = AffinePoint::from(&projective_point_rs).x;
96-
println!("Starknet RS result - X: {:#x} ", starknet_rs_x);
93+
println!("Starknet RS result - X: {starknet_rs_x:#x} ");
9794
let starknet_rs_y = AffinePoint::from(&projective_point_rs).y;
98-
println!("Starknet RS result - Y: {:#x} \n", starknet_rs_y);
95+
println!("Starknet RS result - Y: {starknet_rs_y:#x} \n");
9996

10097
let lambdaworks_affine_generator = StarkCurve::generator();
10198

@@ -106,7 +103,7 @@ pub fn point_add_projective_affine(c: &mut Criterion) {
106103

107104
{
108105
c.bench_function(
109-
&format!("{} 10k Add Projective-Affine | Lambdaworks", BENCHMARK_NAME),
106+
&format!("{BENCHMARK_NAME} 10k Add Projective-Affine | Lambdaworks"),
110107
|b| {
111108
b.iter(|| {
112109
let mut projective_point = lambdaworks_rs_initial_projective.clone();
@@ -128,8 +125,8 @@ pub fn point_add_projective_affine(c: &mut Criterion) {
128125

129126
let lambdaworks_x = projective_point.to_affine().x().to_string();
130127
let lambdaworks_y = projective_point.to_affine().y().to_string();
131-
println!("Lambdaworks result - X: {}", lambdaworks_x);
132-
println!("Lambdaworks result - Y: {}", lambdaworks_y);
128+
println!("Lambdaworks result - X: {lambdaworks_x}");
129+
println!("Lambdaworks result - Y: {lambdaworks_y}");
133130
}
134131

135132
pub fn point_add_projective_projective(c: &mut Criterion) {
@@ -140,10 +137,7 @@ pub fn point_add_projective_projective(c: &mut Criterion) {
140137

141138
{
142139
c.bench_function(
143-
&format!(
144-
"{} 10k Add Projective-Projective | Starknet RS ",
145-
BENCHMARK_NAME
146-
),
140+
&format!("{BENCHMARK_NAME} 10k Add Projective-Projective | Starknet RS "),
147141
|b| {
148142
b.iter(|| {
149143
let mut projective_point_rs = starknet_rs_initial_projective;
@@ -163,9 +157,9 @@ pub fn point_add_projective_projective(c: &mut Criterion) {
163157
}
164158

165159
let starknet_rs_x = AffinePoint::from(&projective_point_rs).x;
166-
println!("Starknet RS result - X: {:#x} ", starknet_rs_x);
160+
println!("Starknet RS result - X: {starknet_rs_x:#x} ");
167161
let starknet_rs_y = AffinePoint::from(&projective_point_rs).y;
168-
println!("Starknet RS result - Y: {:#x} \n", starknet_rs_y);
162+
println!("Starknet RS result - Y: {starknet_rs_y:#x} \n");
169163

170164
let lambdaworks_affine_generator = StarkCurve::generator();
171165

@@ -174,10 +168,7 @@ pub fn point_add_projective_projective(c: &mut Criterion) {
174168

175169
{
176170
c.bench_function(
177-
&format!(
178-
"{} 10k Add Projective-Projective | Lambdaworks",
179-
BENCHMARK_NAME
180-
),
171+
&format!("{BENCHMARK_NAME} 10k Add Projective-Projective | Lambdaworks"),
181172
|b| {
182173
b.iter(|| {
183174
let mut projective_point = lambdaworks_rs_initial_projective.clone();
@@ -199,8 +190,8 @@ pub fn point_add_projective_projective(c: &mut Criterion) {
199190

200191
let lambdaworks_x = projective_point.to_affine().x().to_string();
201192
let lambdaworks_y = projective_point.to_affine().y().to_string();
202-
println!("Lambdaworks result - X: {}", lambdaworks_x);
203-
println!("Lambdaworks result - Y: {}", lambdaworks_y);
193+
println!("Lambdaworks result - X: {lambdaworks_x}");
194+
println!("Lambdaworks result - Y: {lambdaworks_y}");
204195
}
205196

206197
pub fn point_add_affine_affine(c: &mut Criterion) {
@@ -210,7 +201,7 @@ pub fn point_add_affine_affine(c: &mut Criterion) {
210201

211202
{
212203
c.bench_function(
213-
&format!("{} 10k Add Affine-Affine | Starknet RS ", BENCHMARK_NAME),
204+
&format!("{BENCHMARK_NAME} 10k Add Affine-Affine | Starknet RS "),
214205
|b| {
215206
b.iter(|| {
216207
let mut point_rs = *starknet_rs_initial_point;
@@ -229,17 +220,17 @@ pub fn point_add_affine_affine(c: &mut Criterion) {
229220
}
230221

231222
let starknet_rs_x = point_rs.x;
232-
println!("Starknet RS result - X: {:#x} ", starknet_rs_x);
223+
println!("Starknet RS result - X: {starknet_rs_x:#x} ");
233224
let starknet_rs_y = &point_rs.y;
234-
println!("Starknet RS result - Y: {:#x} \n", starknet_rs_y);
225+
println!("Starknet RS result - Y: {starknet_rs_y:#x} \n");
235226

236227
let lambdaworks_affine_generator = StarkCurve::generator();
237228

238229
let lambdaworks_rs_initial_projective =
239230
StarkCurve::generator().operate_with(&StarkCurve::generator());
240231
{
241232
c.bench_function(
242-
&format!("{} 10k Add Affine-Affine | Lambdaworks", BENCHMARK_NAME),
233+
&format!("{BENCHMARK_NAME} 10k Add Affine-Affine | Lambdaworks"),
243234
|b| {
244235
b.iter(|| {
245236
let mut projective_point = lambdaworks_rs_initial_projective.clone();
@@ -261,8 +252,8 @@ pub fn point_add_affine_affine(c: &mut Criterion) {
261252

262253
let lambdaworks_x = projective_point.to_affine().x().to_string();
263254
let lambdaworks_y = projective_point.to_affine().y().to_string();
264-
println!("Lambdaworks result - X: {}", lambdaworks_x);
265-
println!("Lambdaworks result - Y: {}", lambdaworks_y);
255+
println!("Lambdaworks result - X: {lambdaworks_x}");
256+
println!("Lambdaworks result - Y: {lambdaworks_y}");
266257
}
267258

268259
criterion_group!(

benches/benches/pow.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ pub fn criterion_benchmark(c: &mut Criterion) {
2222
// arkworks-ff
2323
{
2424
c.bench_function(
25-
&format!("{} 10K elements | ark-ff - ef8f758", BENCHMARK_NAME),
25+
&format!("{BENCHMARK_NAME} 10K elements | ark-ff - ef8f758"),
2626
|b| {
2727
b.iter(|| {
2828
let mut iter = arkworks_vec.iter();
@@ -43,7 +43,7 @@ pub fn criterion_benchmark(c: &mut Criterion) {
4343
let lambdaworks_vec = to_lambdaworks_vec(&arkworks_vec);
4444

4545
c.bench_function(
46-
&format!("{} 10K elements | lambdaworks", BENCHMARK_NAME,),
46+
&format!("{BENCHMARK_NAME} 10K elements | lambdaworks",),
4747
|b| {
4848
b.iter(|| {
4949
let mut iter = lambdaworks_vec.iter();

benches/benches/sqrt.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ pub fn criterion_benchmark(c: &mut Criterion) {
2222
// arkworks-ff
2323
{
2424
c.bench_function(
25-
&format!("{} 100 elements | ark-ff - ef8f758", BENCHMARK_NAME),
25+
&format!("{BENCHMARK_NAME} 100 elements | ark-ff - ef8f758"),
2626
|b| {
2727
b.iter(|| {
2828
let mut iter = arkworks_vec.iter();
@@ -41,7 +41,7 @@ pub fn criterion_benchmark(c: &mut Criterion) {
4141
let lambdaworks_vec = to_lambdaworks_vec(&arkworks_vec);
4242

4343
c.bench_function(
44-
&format!("{} 100 elements | lambdaworks", BENCHMARK_NAME,),
44+
&format!("{BENCHMARK_NAME} 100 elements | lambdaworks",),
4545
|b| {
4646
b.iter(|| {
4747
let mut iter = lambdaworks_vec.iter();

benches/benches/sub.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ pub fn criterion_benchmark(c: &mut Criterion) {
1212
// arkworks-ff
1313
{
1414
c.bench_function(
15-
&format!("{} 1M elements | ark-ff - ef8f758", BENCHMARK_NAME),
15+
&format!("{BENCHMARK_NAME} 1M elements | ark-ff - ef8f758"),
1616
|b| {
1717
b.iter(|| {
1818
let mut iter = arkworks_vec.iter();
@@ -31,7 +31,7 @@ pub fn criterion_benchmark(c: &mut Criterion) {
3131
{
3232
let lambdaworks_vec = to_lambdaworks_vec(&arkworks_vec);
3333
c.bench_function(
34-
&format!("{} 1M elements | lambdaworks", BENCHMARK_NAME,),
34+
&format!("{BENCHMARK_NAME} 1M elements | lambdaworks",),
3535
|b| {
3636
b.iter(|| {
3737
let mut iter = lambdaworks_vec.iter();

crates/crypto/src/hash/hash_to_field.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ fn os2ip<M: IsModulus<UnsignedInteger<N>> + Clone, const N: usize>(
4444
let mut item_hex = String::with_capacity(N * 16);
4545
let mut result = FieldElement::zero();
4646
for item_u8 in aux_x.iter() {
47-
item_hex += &format!("{:x}", item_u8);
47+
item_hex += &format!("{item_u8:x}");
4848
if item_hex.len() == item_hex.capacity() {
4949
result += FieldElement::from_hex_unchecked(&item_hex) * two_to_the_nth.pow(j);
5050
item_hex.clear();

crates/crypto/src/hash/rescue_prime/rescue_prime_optimized.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -799,10 +799,10 @@ mod tests {
799799

800800
let hash_result = rescue.hash_bytes(input);
801801

802-
println!("Input: {:?}", input);
802+
println!("Input: {input:?}");
803803
println!("Hash result:");
804804
for (i, value) in hash_result.iter().enumerate() {
805-
println!(" {}: {}", i, value);
805+
println!(" {i}: {value}");
806806
}
807807

808808
println!("Hash as u64 values:");

crates/math/benches/elliptic_curves/bn_254.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ pub fn bn_254_elliptic_curve_benchmarks(c: &mut Criterion) {
121121

122122
// Batch Pairing
123123
for num_pairs in 1..=10 {
124-
group.bench_function(format!("Ate Pairing ({} pairs)", num_pairs), |bencher| {
124+
group.bench_function(format!("Ate Pairing ({num_pairs} pairs)"), |bencher| {
125125
let mut rng = StdRng::seed_from_u64(42);
126126
let mut g1_points: Vec<G1> = Vec::new();
127127
let mut g2_points: Vec<G2> = Vec::new();

0 commit comments

Comments
 (0)