Skip to content

Commit ccfd366

Browse files
authored
CI: bump clippy to 1.72 and fix warnings (#270)
1 parent ed9a92f commit ccfd366

File tree

10 files changed

+15
-9
lines changed

10 files changed

+15
-9
lines changed

.github/workflows/crypto-bigint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ jobs:
115115
- uses: actions/checkout@v3
116116
- uses: dtolnay/rust-toolchain@master
117117
with:
118-
toolchain: 1.65.0
118+
toolchain: 1.72.0
119119
components: clippy
120120
- run: cargo clippy --all --all-features -- -D warnings
121121

src/boxed/uint/add.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ impl CheckedAdd<&BoxedUint> for BoxedUint {
2626
}
2727

2828
#[cfg(test)]
29+
#[allow(clippy::unwrap_used)]
2930
mod tests {
3031
use super::{BoxedUint, CheckedAdd, Limb};
3132

src/checked.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,9 @@ impl<T: Copy + Serialize> Serialize for Checked<T> {
8383
}
8484

8585
#[cfg(all(test, feature = "serde"))]
86+
#[allow(clippy::unwrap_used)]
8687
mod tests {
88+
8789
use crate::{Checked, U64};
8890
use subtle::{Choice, ConstantTimeEq, CtOption};
8991

src/limb.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
//! Big integers are represented as an array of smaller CPU word-size integers
22
//! called "limbs".
33
4-
#![allow(clippy::derive_hash_xor_eq)]
5-
64
mod add;
75
mod bit_and;
86
mod bit_not;
@@ -60,6 +58,8 @@ pub(crate) const HI_BIT: usize = Limb::BITS - 1;
6058

6159
/// Big integers are represented as an array of smaller CPU word-size integers
6260
/// called "limbs".
61+
// Our PartialEq impl only differs from the default one by being constant-time, so this is safe
62+
#[allow(clippy::derived_hash_with_manual_eq)]
6363
#[derive(Copy, Clone, Default, Hash)]
6464
#[repr(transparent)]
6565
pub struct Limb(pub Word);

src/non_zero.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,7 @@ impl<T: Serialize + Zero> Serialize for NonZero<T> {
352352
}
353353

354354
#[cfg(all(test, feature = "serde"))]
355+
#[allow(clippy::unwrap_used)]
355356
mod tests {
356357
use crate::{NonZero, U64};
357358
use bincode::ErrorKind;

src/uint.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
//! Stack-allocated big unsigned integers.
22
3-
#![allow(
4-
clippy::needless_range_loop,
5-
clippy::many_single_char_names,
6-
clippy::derive_hash_xor_eq
7-
)]
3+
#![allow(clippy::needless_range_loop, clippy::many_single_char_names)]
84

95
#[macro_use]
106
mod macros;
@@ -71,6 +67,8 @@ use zeroize::DefaultIsZeroes;
7167
///
7268
/// [RLP]: https://eth.wiki/fundamentals/rlp
7369
// TODO(tarcieri): make generic around a specified number of bits.
70+
// Our PartialEq impl only differs from the default one by being constant-time, so this is safe
71+
#[allow(clippy::derived_hash_with_manual_eq)]
7472
#[derive(Copy, Clone, Hash)]
7573
pub struct Uint<const LIMBS: usize> {
7674
/// Inner limb array. Stored from least significant to most significant.
@@ -396,6 +394,7 @@ mod extra_sizes;
396394
pub use extra_sizes::*;
397395

398396
#[cfg(test)]
397+
#[allow(clippy::unwrap_used)]
399398
mod tests {
400399
use crate::{Encoding, U128};
401400
use subtle::ConditionallySelectable;

src/uint/div.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -730,6 +730,7 @@ mod tests {
730730
}
731731
}
732732

733+
#[allow(clippy::op_ref)]
733734
#[test]
734735
fn rem_trait() {
735736
let a = U256::from(10u64);

src/uint/encoding/rlp.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ where
4444
}
4545

4646
#[cfg(test)]
47+
#[allow(clippy::unwrap_used)]
4748
mod tests {
4849
use crate::U256;
4950
use hex_literal::hex;

src/uint/modular/constant_mod/const_inv.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ mod tests {
6262
let x_mod = const_residue!(x, Modulus);
6363

6464
let (inv, _is_some) = x_mod.invert();
65-
let res = &x_mod * &inv;
65+
let res = x_mod * inv;
6666

6767
assert_eq!(res.retrieve(), U256::ONE);
6868
}

src/wrapping.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ impl<T: Serialize> Serialize for Wrapping<T> {
9191
}
9292

9393
#[cfg(all(test, feature = "serde"))]
94+
#[allow(clippy::unwrap_used)]
9495
mod tests {
9596
use crate::{Wrapping, U64};
9697

0 commit comments

Comments
 (0)