Skip to content

Commit ad4a37d

Browse files
authored
CI: bump clippy to Rust 1.87 (#768)
* CI: bump `clippy` to Rust 1.87 Performs a `cargo clippy --fix` * ed25519: fix warning * Rename solitary `'b` lifetimes to `'a`
1 parent 5e0b429 commit ad4a37d

File tree

8 files changed

+71
-71
lines changed

8 files changed

+71
-71
lines changed

.github/workflows/workspace.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ jobs:
8585
runs-on: ubuntu-latest
8686
steps:
8787
- uses: actions/checkout@v3
88-
- uses: dtolnay/rust-toolchain@1.81.0
88+
- uses: dtolnay/rust-toolchain@1.87.0
8989
with:
9090
components: clippy
9191
- run: cargo clippy --target x86_64-unknown-linux-gnu --all-features

curve25519-dalek/src/backend/serial/curve_models/mod.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -408,10 +408,10 @@ impl ProjectivePoint {
408408
//
409409
// upstream rust issue: https://github.com/rust-lang/rust/issues/46380
410410
//#[doc(hidden)]
411-
impl<'a, 'b> Add<&'b ProjectiveNielsPoint> for &'a EdwardsPoint {
411+
impl<'a> Add<&'a ProjectiveNielsPoint> for &EdwardsPoint {
412412
type Output = CompletedPoint;
413413

414-
fn add(self, other: &'b ProjectiveNielsPoint) -> CompletedPoint {
414+
fn add(self, other: &'a ProjectiveNielsPoint) -> CompletedPoint {
415415
let Y_plus_X = &self.Y + &self.X;
416416
let Y_minus_X = &self.Y - &self.X;
417417
let PP = &Y_plus_X * &other.Y_plus_X;
@@ -430,10 +430,10 @@ impl<'a, 'b> Add<&'b ProjectiveNielsPoint> for &'a EdwardsPoint {
430430
}
431431

432432
//#[doc(hidden)]
433-
impl<'a, 'b> Sub<&'b ProjectiveNielsPoint> for &'a EdwardsPoint {
433+
impl<'a> Sub<&'a ProjectiveNielsPoint> for &EdwardsPoint {
434434
type Output = CompletedPoint;
435435

436-
fn sub(self, other: &'b ProjectiveNielsPoint) -> CompletedPoint {
436+
fn sub(self, other: &'a ProjectiveNielsPoint) -> CompletedPoint {
437437
let Y_plus_X = &self.Y + &self.X;
438438
let Y_minus_X = &self.Y - &self.X;
439439
let PM = &Y_plus_X * &other.Y_minus_X;
@@ -452,10 +452,10 @@ impl<'a, 'b> Sub<&'b ProjectiveNielsPoint> for &'a EdwardsPoint {
452452
}
453453

454454
//#[doc(hidden)]
455-
impl<'a, 'b> Add<&'b AffineNielsPoint> for &'a EdwardsPoint {
455+
impl<'a> Add<&'a AffineNielsPoint> for &EdwardsPoint {
456456
type Output = CompletedPoint;
457457

458-
fn add(self, other: &'b AffineNielsPoint) -> CompletedPoint {
458+
fn add(self, other: &'a AffineNielsPoint) -> CompletedPoint {
459459
let Y_plus_X = &self.Y + &self.X;
460460
let Y_minus_X = &self.Y - &self.X;
461461
let PP = &Y_plus_X * &other.y_plus_x;
@@ -473,10 +473,10 @@ impl<'a, 'b> Add<&'b AffineNielsPoint> for &'a EdwardsPoint {
473473
}
474474

475475
//#[doc(hidden)]
476-
impl<'a, 'b> Sub<&'b AffineNielsPoint> for &'a EdwardsPoint {
476+
impl<'a> Sub<&'a AffineNielsPoint> for &EdwardsPoint {
477477
type Output = CompletedPoint;
478478

479-
fn sub(self, other: &'b AffineNielsPoint) -> CompletedPoint {
479+
fn sub(self, other: &'a AffineNielsPoint) -> CompletedPoint {
480480
let Y_plus_X = &self.Y + &self.X;
481481
let Y_minus_X = &self.Y - &self.X;
482482
let PM = &Y_plus_X * &other.y_minus_x;
@@ -497,7 +497,7 @@ impl<'a, 'b> Sub<&'b AffineNielsPoint> for &'a EdwardsPoint {
497497
// Negation
498498
// ------------------------------------------------------------------------
499499

500-
impl<'a> Neg for &'a ProjectiveNielsPoint {
500+
impl Neg for &ProjectiveNielsPoint {
501501
type Output = ProjectiveNielsPoint;
502502

503503
fn neg(self) -> ProjectiveNielsPoint {
@@ -510,7 +510,7 @@ impl<'a> Neg for &'a ProjectiveNielsPoint {
510510
}
511511
}
512512

513-
impl<'a> Neg for &'a AffineNielsPoint {
513+
impl Neg for &AffineNielsPoint {
514514
type Output = AffineNielsPoint;
515515

516516
fn neg(self) -> AffineNielsPoint {

curve25519-dalek/src/backend/serial/u64/field.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -55,33 +55,33 @@ impl Zeroize for FieldElement51 {
5555
}
5656
}
5757

58-
impl<'b> AddAssign<&'b FieldElement51> for FieldElement51 {
59-
fn add_assign(&mut self, _rhs: &'b FieldElement51) {
58+
impl<'a> AddAssign<&'a FieldElement51> for FieldElement51 {
59+
fn add_assign(&mut self, _rhs: &'a FieldElement51) {
6060
for i in 0..5 {
6161
self.0[i] += _rhs.0[i];
6262
}
6363
}
6464
}
6565

66-
impl<'a, 'b> Add<&'b FieldElement51> for &'a FieldElement51 {
66+
impl<'a> Add<&'a FieldElement51> for &FieldElement51 {
6767
type Output = FieldElement51;
68-
fn add(self, _rhs: &'b FieldElement51) -> FieldElement51 {
68+
fn add(self, _rhs: &'a FieldElement51) -> FieldElement51 {
6969
let mut output = *self;
7070
output += _rhs;
7171
output
7272
}
7373
}
7474

75-
impl<'b> SubAssign<&'b FieldElement51> for FieldElement51 {
76-
fn sub_assign(&mut self, _rhs: &'b FieldElement51) {
75+
impl<'a> SubAssign<&'a FieldElement51> for FieldElement51 {
76+
fn sub_assign(&mut self, _rhs: &'a FieldElement51) {
7777
let result = (self as &FieldElement51) - _rhs;
7878
self.0 = result.0;
7979
}
8080
}
8181

82-
impl<'a, 'b> Sub<&'b FieldElement51> for &'a FieldElement51 {
82+
impl<'a> Sub<&'a FieldElement51> for &FieldElement51 {
8383
type Output = FieldElement51;
84-
fn sub(self, _rhs: &'b FieldElement51) -> FieldElement51 {
84+
fn sub(self, _rhs: &'a FieldElement51) -> FieldElement51 {
8585
// To avoid underflow, first add a multiple of p.
8686
// Choose 16*p = p << 4 to be larger than 54-bit _rhs.
8787
//
@@ -101,18 +101,18 @@ impl<'a, 'b> Sub<&'b FieldElement51> for &'a FieldElement51 {
101101
}
102102
}
103103

104-
impl<'b> MulAssign<&'b FieldElement51> for FieldElement51 {
105-
fn mul_assign(&mut self, _rhs: &'b FieldElement51) {
104+
impl<'a> MulAssign<&'a FieldElement51> for FieldElement51 {
105+
fn mul_assign(&mut self, _rhs: &'a FieldElement51) {
106106
let result = (self as &FieldElement51) * _rhs;
107107
self.0 = result.0;
108108
}
109109
}
110110

111-
impl<'a, 'b> Mul<&'b FieldElement51> for &'a FieldElement51 {
111+
impl<'a> Mul<&'a FieldElement51> for &FieldElement51 {
112112
type Output = FieldElement51;
113113

114114
#[rustfmt::skip] // keep alignment of c* calculations
115-
fn mul(self, _rhs: &'b FieldElement51) -> FieldElement51 {
115+
fn mul(self, _rhs: &'a FieldElement51) -> FieldElement51 {
116116
/// Helper function to multiply two 64-bit integers with 128
117117
/// bits of output.
118118
#[inline(always)]
@@ -213,7 +213,7 @@ impl<'a, 'b> Mul<&'b FieldElement51> for &'a FieldElement51 {
213213
}
214214
}
215215

216-
impl<'a> Neg for &'a FieldElement51 {
216+
impl Neg for &FieldElement51 {
217217
type Output = FieldElement51;
218218
fn neg(self) -> FieldElement51 {
219219
let mut output = *self;

curve25519-dalek/src/edwards.rs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -694,9 +694,9 @@ impl EdwardsPoint {
694694
// Addition and Subtraction
695695
// ------------------------------------------------------------------------
696696

697-
impl<'a, 'b> Add<&'b EdwardsPoint> for &'a EdwardsPoint {
697+
impl<'a> Add<&'a EdwardsPoint> for &EdwardsPoint {
698698
type Output = EdwardsPoint;
699-
fn add(self, other: &'b EdwardsPoint) -> EdwardsPoint {
699+
fn add(self, other: &'a EdwardsPoint) -> EdwardsPoint {
700700
(self + &other.as_projective_niels()).as_extended()
701701
}
702702
}
@@ -707,17 +707,17 @@ define_add_variants!(
707707
Output = EdwardsPoint
708708
);
709709

710-
impl<'b> AddAssign<&'b EdwardsPoint> for EdwardsPoint {
711-
fn add_assign(&mut self, _rhs: &'b EdwardsPoint) {
710+
impl<'a> AddAssign<&'a EdwardsPoint> for EdwardsPoint {
711+
fn add_assign(&mut self, _rhs: &'a EdwardsPoint) {
712712
*self = (self as &EdwardsPoint) + _rhs;
713713
}
714714
}
715715

716716
define_add_assign_variants!(LHS = EdwardsPoint, RHS = EdwardsPoint);
717717

718-
impl<'a, 'b> Sub<&'b EdwardsPoint> for &'a EdwardsPoint {
718+
impl<'a> Sub<&'a EdwardsPoint> for &EdwardsPoint {
719719
type Output = EdwardsPoint;
720-
fn sub(self, other: &'b EdwardsPoint) -> EdwardsPoint {
720+
fn sub(self, other: &'a EdwardsPoint) -> EdwardsPoint {
721721
(self - &other.as_projective_niels()).as_extended()
722722
}
723723
}
@@ -728,8 +728,8 @@ define_sub_variants!(
728728
Output = EdwardsPoint
729729
);
730730

731-
impl<'b> SubAssign<&'b EdwardsPoint> for EdwardsPoint {
732-
fn sub_assign(&mut self, _rhs: &'b EdwardsPoint) {
731+
impl<'a> SubAssign<&'a EdwardsPoint> for EdwardsPoint {
732+
fn sub_assign(&mut self, _rhs: &'a EdwardsPoint) {
733733
*self = (self as &EdwardsPoint) - _rhs;
734734
}
735735
}
@@ -752,7 +752,7 @@ where
752752
// Negation
753753
// ------------------------------------------------------------------------
754754

755-
impl<'a> Neg for &'a EdwardsPoint {
755+
impl Neg for &EdwardsPoint {
756756
type Output = EdwardsPoint;
757757

758758
fn neg(self) -> EdwardsPoint {
@@ -777,8 +777,8 @@ impl Neg for EdwardsPoint {
777777
// Scalar multiplication
778778
// ------------------------------------------------------------------------
779779

780-
impl<'b> MulAssign<&'b Scalar> for EdwardsPoint {
781-
fn mul_assign(&mut self, scalar: &'b Scalar) {
780+
impl<'a> MulAssign<&'a Scalar> for EdwardsPoint {
781+
fn mul_assign(&mut self, scalar: &'a Scalar) {
782782
let result = (self as &EdwardsPoint) * scalar;
783783
*self = result;
784784
}
@@ -789,25 +789,25 @@ define_mul_assign_variants!(LHS = EdwardsPoint, RHS = Scalar);
789789
define_mul_variants!(LHS = EdwardsPoint, RHS = Scalar, Output = EdwardsPoint);
790790
define_mul_variants!(LHS = Scalar, RHS = EdwardsPoint, Output = EdwardsPoint);
791791

792-
impl<'a, 'b> Mul<&'b Scalar> for &'a EdwardsPoint {
792+
impl<'a> Mul<&'a Scalar> for &EdwardsPoint {
793793
type Output = EdwardsPoint;
794794
/// Scalar multiplication: compute `scalar * self`.
795795
///
796796
/// For scalar multiplication of a basepoint,
797797
/// `EdwardsBasepointTable` is approximately 4x faster.
798-
fn mul(self, scalar: &'b Scalar) -> EdwardsPoint {
798+
fn mul(self, scalar: &'a Scalar) -> EdwardsPoint {
799799
crate::backend::variable_base_mul(self, scalar)
800800
}
801801
}
802802

803-
impl<'a, 'b> Mul<&'b EdwardsPoint> for &'a Scalar {
803+
impl<'a> Mul<&'a EdwardsPoint> for &Scalar {
804804
type Output = EdwardsPoint;
805805

806806
/// Scalar multiplication: compute `scalar * self`.
807807
///
808808
/// For scalar multiplication of a basepoint,
809809
/// `EdwardsBasepointTable` is approximately 4x faster.
810-
fn mul(self, point: &'b EdwardsPoint) -> EdwardsPoint {
810+
fn mul(self, point: &'a EdwardsPoint) -> EdwardsPoint {
811811
point * self
812812
}
813813
}

curve25519-dalek/src/montgomery.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,7 @@ mod test {
543543
let mut csprng = rand_core::OsRng;
544544

545545
for _ in 0..100 {
546-
let p_edwards = rand_prime_order_point(&mut csprng);
546+
let p_edwards = rand_prime_order_point(csprng);
547547
let p_montgomery: MontgomeryPoint = p_edwards.to_montgomery();
548548

549549
let s: Scalar = Scalar::random(&mut csprng);
@@ -562,7 +562,7 @@ mod test {
562562

563563
for _ in 0..100 {
564564
// Make a random prime-order point P
565-
let p_edwards = rand_prime_order_point(&mut csprng);
565+
let p_edwards = rand_prime_order_point(csprng);
566566
let p_montgomery: MontgomeryPoint = p_edwards.to_montgomery();
567567

568568
// Make a random integer b

curve25519-dalek/src/ristretto.rs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -848,10 +848,10 @@ impl Eq for RistrettoPoint {}
848848
// Arithmetic
849849
// ------------------------------------------------------------------------
850850

851-
impl<'a, 'b> Add<&'b RistrettoPoint> for &'a RistrettoPoint {
851+
impl<'a> Add<&'a RistrettoPoint> for &RistrettoPoint {
852852
type Output = RistrettoPoint;
853853

854-
fn add(self, other: &'b RistrettoPoint) -> RistrettoPoint {
854+
fn add(self, other: &'a RistrettoPoint) -> RistrettoPoint {
855855
RistrettoPoint(self.0 + other.0)
856856
}
857857
}
@@ -862,18 +862,18 @@ define_add_variants!(
862862
Output = RistrettoPoint
863863
);
864864

865-
impl<'b> AddAssign<&'b RistrettoPoint> for RistrettoPoint {
865+
impl AddAssign<&RistrettoPoint> for RistrettoPoint {
866866
fn add_assign(&mut self, _rhs: &RistrettoPoint) {
867867
*self = (self as &RistrettoPoint) + _rhs;
868868
}
869869
}
870870

871871
define_add_assign_variants!(LHS = RistrettoPoint, RHS = RistrettoPoint);
872872

873-
impl<'a, 'b> Sub<&'b RistrettoPoint> for &'a RistrettoPoint {
873+
impl<'a> Sub<&'a RistrettoPoint> for &RistrettoPoint {
874874
type Output = RistrettoPoint;
875875

876-
fn sub(self, other: &'b RistrettoPoint) -> RistrettoPoint {
876+
fn sub(self, other: &'a RistrettoPoint) -> RistrettoPoint {
877877
RistrettoPoint(self.0 - other.0)
878878
}
879879
}
@@ -884,7 +884,7 @@ define_sub_variants!(
884884
Output = RistrettoPoint
885885
);
886886

887-
impl<'b> SubAssign<&'b RistrettoPoint> for RistrettoPoint {
887+
impl SubAssign<&RistrettoPoint> for RistrettoPoint {
888888
fn sub_assign(&mut self, _rhs: &RistrettoPoint) {
889889
*self = (self as &RistrettoPoint) - _rhs;
890890
}
@@ -904,7 +904,7 @@ where
904904
}
905905
}
906906

907-
impl<'a> Neg for &'a RistrettoPoint {
907+
impl Neg for &RistrettoPoint {
908908
type Output = RistrettoPoint;
909909

910910
fn neg(self) -> RistrettoPoint {
@@ -920,26 +920,26 @@ impl Neg for RistrettoPoint {
920920
}
921921
}
922922

923-
impl<'b> MulAssign<&'b Scalar> for RistrettoPoint {
924-
fn mul_assign(&mut self, scalar: &'b Scalar) {
923+
impl<'a> MulAssign<&'a Scalar> for RistrettoPoint {
924+
fn mul_assign(&mut self, scalar: &'a Scalar) {
925925
let result = (self as &RistrettoPoint) * scalar;
926926
*self = result;
927927
}
928928
}
929929

930-
impl<'a, 'b> Mul<&'b Scalar> for &'a RistrettoPoint {
930+
impl<'a> Mul<&'a Scalar> for &RistrettoPoint {
931931
type Output = RistrettoPoint;
932932
/// Scalar multiplication: compute `scalar * self`.
933-
fn mul(self, scalar: &'b Scalar) -> RistrettoPoint {
933+
fn mul(self, scalar: &'a Scalar) -> RistrettoPoint {
934934
RistrettoPoint(self.0 * scalar)
935935
}
936936
}
937937

938-
impl<'a, 'b> Mul<&'b RistrettoPoint> for &'a Scalar {
938+
impl<'a> Mul<&'a RistrettoPoint> for &Scalar {
939939
type Output = RistrettoPoint;
940940

941941
/// Scalar multiplication: compute `self * scalar`.
942-
fn mul(self, point: &'b RistrettoPoint) -> RistrettoPoint {
942+
fn mul(self, point: &'a RistrettoPoint) -> RistrettoPoint {
943943
RistrettoPoint(self * point.0)
944944
}
945945
}
@@ -1093,7 +1093,7 @@ impl RistrettoPoint {
10931093
pub struct RistrettoBasepointTable(pub(crate) EdwardsBasepointTable);
10941094

10951095
#[cfg(feature = "precomputed-tables")]
1096-
impl<'a, 'b> Mul<&'b Scalar> for &'a RistrettoBasepointTable {
1096+
impl<'b> Mul<&'b Scalar> for &RistrettoBasepointTable {
10971097
type Output = RistrettoPoint;
10981098

10991099
fn mul(self, scalar: &'b Scalar) -> RistrettoPoint {
@@ -1102,7 +1102,7 @@ impl<'a, 'b> Mul<&'b Scalar> for &'a RistrettoBasepointTable {
11021102
}
11031103

11041104
#[cfg(feature = "precomputed-tables")]
1105-
impl<'a, 'b> Mul<&'a RistrettoBasepointTable> for &'b Scalar {
1105+
impl<'a> Mul<&'a RistrettoBasepointTable> for &Scalar {
11061106
type Output = RistrettoPoint;
11071107

11081108
fn mul(self, basepoint_table: &'a RistrettoBasepointTable) -> RistrettoPoint {

0 commit comments

Comments
 (0)