Skip to content

Commit ec55a8e

Browse files
authored
Upgrade to Rust 1.85 (#1526)
* Upgrade to Rust 1.85 * Fix nightly lints * Remove another redundant into_iter call
1 parent cb7a54e commit ec55a8e

7 files changed

Lines changed: 18 additions & 28 deletions

File tree

ipa-core/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ version = "0.1.0"
66
# rust:slim-bullseye docker image is available.
77
# 2. Update the rust version used for draft in
88
# https://github.com/private-attribution/draft/blob/main/sidecar/ansible/provision.yaml.
9-
rust-version = "1.84.0"
9+
rust-version = "1.85.0"
1010
edition = "2021"
1111
build = "build.rs"
1212

ipa-core/src/ff/galois_field.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ fn clmul<GF: GaloisField>(a: GF, b: GF) -> u128 {
131131
let a = u128::from(a);
132132
let mut product = 0;
133133
for i in 0..GF::BITS {
134-
let bit = u128::from(b >> i & 1);
134+
let bit = u128::from((b >> i) & 1);
135135
product ^= bit * (a << i);
136136
}
137137
product

ipa-core/src/helpers/buffers/circular.rs

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -462,11 +462,7 @@ mod test {
462462
assert!(buf.can_read());
463463

464464
while buf.can_read() {
465-
output.extend(
466-
CircularBuf::read_once(&mut buf)
467-
.into_iter()
468-
.map(usize::from),
469-
);
465+
output.extend(CircularBuf::read_once(&mut buf));
470466
}
471467

472468
assert!(buf.can_write());
@@ -478,11 +474,7 @@ mod test {
478474
}
479475

480476
assert!(buf.can_write());
481-
output.extend(
482-
CircularBuf::read_once(&mut buf)
483-
.into_iter()
484-
.map(usize::from),
485-
);
477+
output.extend(CircularBuf::read_once(&mut buf));
486478

487479
assert!(buf.is_empty());
488480
assert_eq!(input, output);
@@ -521,14 +513,14 @@ mod test {
521513
Six::fill(&mut buf);
522514

523515
let mut output = Vec::new();
524-
output.extend(Six::read_once(&mut buf).into_iter().map(usize::from));
516+
output.extend(Six::read_once(&mut buf));
525517
buf.next().write(&TwoBytes::from(&6));
526518
buf.next().write(&TwoBytes::from(&7));
527519
assert!(!buf.is_closed());
528520
buf.close();
529521
assert!(buf.is_closed());
530522

531-
output.extend(Six::read_once(&mut buf).into_iter().map(usize::from));
523+
output.extend(Six::read_once(&mut buf));
532524

533525
assert_eq!((0..8).collect::<Vec<_>>(), output);
534526
}

ipa-core/src/hpke/registry.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,14 +129,12 @@ impl KeyRegistry<KeyPair> {
129129
}
130130

131131
impl PrivateKeyRegistry for KeyRegistry<KeyPair> {
132-
#[must_use]
133132
fn private_key(&self, key_id: KeyIdentifier) -> Option<&IpaPrivateKey> {
134133
self.key(key_id).map(|v| &v.sk)
135134
}
136135
}
137136

138137
impl PrivateKeyRegistry for KeyRegistry<PrivateKeyOnly> {
139-
#[must_use]
140138
fn private_key(&self, key_id: KeyIdentifier) -> Option<&IpaPrivateKey> {
141139
self.key(key_id).map(|sk| &**sk)
142140
}

ipa-core/src/protocol/context/dzkp_field.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ pub mod tests {
404404
let bit0 = (b0 >> j) & 1_u128;
405405
let bit1 = (b1 >> j) & 1_u128;
406406
let bit2 = (b2 >> j) & 1_u128;
407-
let expected = bit2 << 2 | bit1 << 1 | bit0;
407+
let expected = (bit2 << 2) | (bit1 << 1) | bit0;
408408
let actual = (z >> i) & 0xf;
409409
assert_eq!(
410410
actual, expected,

ipa-core/src/protocol/ipa_prf/boolean_ops/addition_sequential.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ mod test {
189189
let y = y_ba64.as_u128();
190190

191191
let expected = (x + y) % (1 << 64);
192-
let expected_carry = (x + y) >> 64 & 1;
192+
let expected_carry = ((x + y) >> 64) & 1;
193193

194194
let (result, carry) = world
195195
.dzkp_semi_honest((x_ba64, y_ba64), |ctx, x_y| async move {
@@ -266,7 +266,7 @@ mod test {
266266
let y = y_ba32.as_u128();
267267

268268
let expected = (x + y) % (1 << 64);
269-
let expected_carry = (x + y) >> 64 & 1;
269+
let expected_carry = ((x + y) >> 64) & 1;
270270

271271
let (result, carry) = world
272272
.dzkp_semi_honest((x_ba64, y_ba32), |ctx, x_y| async move {
@@ -288,7 +288,7 @@ mod test {
288288

289289
let x = x & ((1 << 32) - 1);
290290
let expected = (x + y) % (1 << 32);
291-
let expected_carry = (x + y) >> 32 & 1;
291+
let expected_carry = ((x + y) >> 32) & 1;
292292
let (result, carry) = world
293293
.dzkp_semi_honest((y_ba32, x_ba64), |ctx, x_y| async move {
294294
integer_add::<_, DefaultBitStep, 1>(

ipa-core/src/secret_sharing/vector/transpose.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -107,15 +107,15 @@ pub fn transpose_8x8<B: Borrow<[u8; 8]>>(x: B) -> [u8; 8] {
107107
let mut x = u64::from_le_bytes(*x.borrow());
108108

109109
x = x & 0xaa55_aa55_aa55_aa55
110-
| (x & 0x00aa_00aa_00aa_00aa) << 7
110+
| ((x & 0x00aa_00aa_00aa_00aa) << 7)
111111
| (x >> 7) & 0x00aa_00aa_00aa_00aa;
112112

113113
x = x & 0xcccc_3333_cccc_3333
114-
| (x & 0x0000_cccc_0000_cccc) << 14
114+
| ((x & 0x0000_cccc_0000_cccc) << 14)
115115
| (x >> 14) & 0x0000_cccc_0000_cccc;
116116

117117
x = x & 0xf0f0_f0f0_0f0f_0f0f
118-
| (x & 0x0000_0000_f0f0_f0f0) << 28
118+
| ((x & 0x0000_0000_f0f0_f0f0) << 28)
119119
| (x >> 28) & 0x0000_0000_f0f0_f0f0;
120120

121121
x.to_le_bytes()
@@ -138,11 +138,11 @@ pub fn transpose_16x16(src: &[u8; 32]) -> [u8; 32] {
138138
let s1 = 30;
139139
for i in 0..4 {
140140
y0[i] = x[i] & 0xaaaa_5555_aaaa_5555
141-
| (x[i] & 0x0000_aaaa_0000_aaaa) << s0
141+
| ((x[i] & 0x0000_aaaa_0000_aaaa) << s0)
142142
| (x[i] >> s0) & 0x0000_aaaa_0000_aaaa;
143143

144144
y1[i] = y0[i] & 0xcccc_cccc_3333_3333
145-
| (y0[i] & 0x0000_0000_cccc_cccc) << s1
145+
| ((y0[i] & 0x0000_0000_cccc_cccc) << s1)
146146
| (y0[i] >> s1) & 0x0000_0000_cccc_cccc;
147147
}
148148

@@ -158,15 +158,15 @@ pub fn transpose_16x16(src: &[u8; 32]) -> [u8; 32] {
158158
let s2 = 4;
159159
let mut y2 = [0u64; 4];
160160
for i in 0..4 {
161-
y2[i] = y1[i] & m2a[i] | (y1_swp[i] << s2) & m2b[i] | (y1_swp[i] & m2c[i]) >> s2;
161+
y2[i] = y1[i] & m2a[i] | (y1_swp[i] << s2) & m2b[i] | ((y1_swp[i] & m2c[i]) >> s2);
162162
}
163163

164164
let mut y3 = [0u64; 4];
165165
for i in 0..2 {
166-
y3[i] = y2[i] & 0x00ff_00ff_00ff_00ff | (y2[i + 2] & 0x00ff_00ff_00ff_00ff) << 8;
166+
y3[i] = y2[i] & 0x00ff_00ff_00ff_00ff | ((y2[i + 2] & 0x00ff_00ff_00ff_00ff) << 8);
167167
}
168168
for i in 0..2 {
169-
y3[i + 2] = (y2[i] & 0xff00_ff00_ff00_ff00) >> 8 | y2[i + 2] & 0xff00_ff00_ff00_ff00;
169+
y3[i + 2] = ((y2[i] & 0xff00_ff00_ff00_ff00) >> 8) | y2[i + 2] & 0xff00_ff00_ff00_ff00;
170170
}
171171

172172
let mut dst = [0u8; 32];

0 commit comments

Comments
 (0)