Skip to content

Commit fce073b

Browse files
committed
clippy fixes
1 parent f215246 commit fce073b

File tree

9 files changed

+13
-6
lines changed

9 files changed

+13
-6
lines changed

src/modular/boxed_residue/add.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ impl AddAssign<BoxedResidue> for BoxedResidue {
6363
}
6464

6565
#[cfg(test)]
66+
#[allow(clippy::unwrap_used)]
6667
mod tests {
6768
use crate::{
6869
modular::{BoxedResidue, BoxedResidueParams},

src/modular/boxed_residue/sub.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ impl SubAssign<BoxedResidue> for BoxedResidue {
6464
}
6565

6666
#[cfg(test)]
67+
#[allow(clippy::unwrap_used)]
6768
mod tests {
6869
use crate::{
6970
modular::{BoxedResidue, BoxedResidueParams},

src/uint/boxed/add_mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ impl AddMod for BoxedUint {
3434
}
3535

3636
#[cfg(test)]
37+
#[allow(clippy::unwrap_used)]
3738
mod tests {
3839
use super::BoxedUint;
3940
use hex_literal::hex;

src/uint/boxed/bits.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ impl BoxedUint {
6464
}
6565

6666
#[cfg(test)]
67+
#[allow(clippy::unwrap_used)]
6768
mod tests {
6869
use super::BoxedUint;
6970
use hex_literal::hex;

src/uint/boxed/encoding.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ impl BoxedUint {
118118
}
119119

120120
#[cfg(test)]
121+
#[allow(clippy::unwrap_used)]
121122
mod tests {
122123
use super::{BoxedUint, DecodeError};
123124
use crate::Limb;

src/uint/boxed/inv_mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ impl BoxedUint {
146146
}
147147

148148
#[cfg(test)]
149+
#[allow(clippy::unwrap_used)]
149150
mod tests {
150151
use super::BoxedUint;
151152
use hex_literal::hex;

src/uint/boxed/sub_mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ impl SubMod for BoxedUint {
4949
}
5050

5151
#[cfg(test)]
52+
#[allow(clippy::unwrap_used)]
5253
mod tests {
5354
use super::BoxedUint;
5455
use hex_literal::hex;

tests/boxed_residue_proptests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ proptest! {
8282

8383
let a_bi = retrieve_biguint(&a);
8484
let b_bi = retrieve_biguint(&b);
85-
let p_bi = to_biguint(&p);
85+
let p_bi = to_biguint(p);
8686
let expected = (a_bi * b_bi) % p_bi;
8787

8888
prop_assert_eq!(retrieve_biguint(&actual), expected);

tests/boxed_uint_proptests.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,11 @@ prop_compose! {
4646
prop_compose! {
4747
/// Generate a pair of random `BoxedUint`s with the same precision.
4848
fn uint_pair()(mut a in uint(), mut b in uint()) -> (BoxedUint, BoxedUint) {
49-
if a.bits_precision() > b.bits_precision() {
50-
b = b.widen(a.bits_precision());
51-
} else if a.bits_precision() < b.bits_precision() {
52-
a = a.widen(b.bits_precision());
53-
}
49+
match a.bits_precision().cmp(&b.bits_precision()) {
50+
Ordering::Less => a = a.widen(b.bits_precision()),
51+
Ordering::Equal => {},
52+
Ordering::Greater => b = b.widen(a.bits_precision()),
53+
};
5454

5555
(a, b)
5656
}

0 commit comments

Comments
 (0)