Skip to content

Commit

Permalink
chore: cargo clippy fixes for 1.83.0 (#196)
Browse files Browse the repository at this point in the history
  • Loading branch information
heeckhau authored Dec 14, 2024
1 parent b2e985c commit 07ed76b
Show file tree
Hide file tree
Showing 10 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion crates/clmul/src/backend/soft32.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,5 +188,5 @@ fn rev32(mut x: u32) -> u32 {
x = ((x & 0x3333_3333) << 2) | (x >> 2 & 0x3333_3333);
x = ((x & 0x0f0f_0f0f) << 4) | (x >> 4 & 0x0f0f_0f0f);
x = ((x & 0x00ff_00ff) << 8) | (x >> 8 & 0x00ff_00ff);
(x << 16) | (x >> 16)
x.rotate_right(16)
}
2 changes: 1 addition & 1 deletion crates/clmul/src/backend/soft64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,5 +113,5 @@ fn rev64(mut x: u64) -> u64 {
x = ((x & 0x0f0f_0f0f_0f0f_0f0f) << 4) | ((x >> 4) & 0x0f0f_0f0f_0f0f_0f0f);
x = ((x & 0x00ff_00ff_00ff_00ff) << 8) | ((x >> 8) & 0x00ff_00ff_00ff_00ff);
x = ((x & 0xffff_0000_ffff) << 16) | ((x >> 16) & 0xffff_0000_ffff);
(x << 32) | (x >> 32)
x.rotate_right(32)
}
2 changes: 1 addition & 1 deletion crates/mpz-circuits/src/tracer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ where
}
}

impl<'a> Tracer<'a, Bit> {
impl Tracer<'_, Bit> {
/// Returns the single node associated with the bit.
pub fn node(&self) -> Node<Feed> {
self.to_inner().nodes()[0]
Expand Down
2 changes: 1 addition & 1 deletion crates/mpz-common/src/sync/async_syncer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ impl<'a, Fut> Wait<'a, Fut> {
}
}

impl<'a, Fut> Future for Wait<'a, Fut>
impl<Fut> Future for Wait<'_, Fut>
where
Fut: Future,
{
Expand Down
2 changes: 1 addition & 1 deletion crates/mpz-common/src/sync/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ impl<'a, F> Wait<'a, F> {
}
}

impl<'a, F, R> Future for Wait<'a, F>
impl<F, R> Future for Wait<'_, F>
where
F: FnOnce() -> R + Unpin,
R: Unpin,
Expand Down
2 changes: 1 addition & 1 deletion crates/mpz-core/src/lpn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ impl<const D: usize> LpnEncoder<D> {

#[inline]
fn compute_one_row(&self, y: &mut [Block], x: &[Block], pos: usize, prp: &Prp) {
let block_size = (D + 4 - 1) / 4;
let block_size = D.div_ceil(4);
let mut index = (0..block_size)
.map(|i| Block::from(bytemuck::cast::<_, [u8; 16]>([pos as u64, i as u64])))
.collect::<Vec<Block>>();
Expand Down
6 changes: 3 additions & 3 deletions crates/mpz-garble-core/src/evaluator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ impl Evaluator {
&'a mut self,
circ: &'a Circuit,
inputs: Vec<EncodedValue<state::Active>>,
) -> Result<EncryptedGateConsumer<'_, std::slice::Iter<'_, Gate>>, EvaluatorError> {
) -> Result<EncryptedGateConsumer<'a, std::slice::Iter<'a, Gate>>, EvaluatorError> {
if inputs.len() != circ.inputs().len() {
return Err(CircuitError::InvalidInputCount(
circ.inputs().len(),
Expand Down Expand Up @@ -129,7 +129,7 @@ impl Evaluator {
&'a mut self,
circ: &'a Circuit,
inputs: Vec<EncodedValue<state::Active>>,
) -> Result<EncryptedGateBatchConsumer<'_, std::slice::Iter<'_, Gate>>, EvaluatorError> {
) -> Result<EncryptedGateBatchConsumer<'a, std::slice::Iter<'a, Gate>>, EvaluatorError> {
self.evaluate(circ, inputs).map(EncryptedGateBatchConsumer)
}
}
Expand All @@ -156,7 +156,7 @@ pub struct EncryptedGateConsumer<'a, I: Iterator> {
complete: bool,
}

impl<'a, I: Iterator> fmt::Debug for EncryptedGateConsumer<'a, I> {
impl<I: Iterator> fmt::Debug for EncryptedGateConsumer<'_, I> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "EncryptedGateConsumer {{ .. }}")
}
Expand Down
6 changes: 3 additions & 3 deletions crates/mpz-garble-core/src/generator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ impl Generator {
circ: &'a Circuit,
delta: Delta,
inputs: Vec<EncodedValue<state::Full>>,
) -> Result<EncryptedGateIter<'_, std::slice::Iter<'_, Gate>>, GeneratorError> {
) -> Result<EncryptedGateIter<'a, std::slice::Iter<'a, Gate>>, GeneratorError> {
if inputs.len() != circ.inputs().len() {
return Err(CircuitError::InvalidInputCount(
circ.inputs().len(),
Expand Down Expand Up @@ -143,7 +143,7 @@ impl Generator {
circ: &'a Circuit,
delta: Delta,
inputs: Vec<EncodedValue<state::Full>>,
) -> Result<EncryptedGateBatchIter<'_, std::slice::Iter<'_, Gate>>, GeneratorError> {
) -> Result<EncryptedGateBatchIter<'a, std::slice::Iter<'a, Gate>>, GeneratorError> {
self.generate(circ, delta, inputs)
.map(EncryptedGateBatchIter)
}
Expand Down Expand Up @@ -173,7 +173,7 @@ pub struct EncryptedGateIter<'a, I> {
complete: bool,
}

impl<'a, I> fmt::Debug for EncryptedGateIter<'a, I> {
impl<I> fmt::Debug for EncryptedGateIter<'_, I> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "EncryptedGateIter {{ .. }}")
}
Expand Down
2 changes: 1 addition & 1 deletion crates/mpz-ot-core/src/ferret/mpcot/receiver_regular.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ impl Receiver<state::PreExtension> {
}

// The range of each interval.
let k = (n + t - 1) / t;
let k = n.div_ceil(t);

let queries_length = if n % t == 0 {
vec![k as usize; t as usize]
Expand Down
2 changes: 1 addition & 1 deletion crates/mpz-ot-core/src/ferret/mpcot/sender_regular.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ impl Sender<state::PreExtension> {
}

// The range of each interval.
let k = (n + t - 1) / t;
let k = n.div_ceil(t);

let queries_length = if n % t == 0 {
vec![k as usize; t as usize]
Expand Down

0 comments on commit 07ed76b

Please sign in to comment.