Skip to content

Commit

Permalink
Fix unused qualifications warnings
Browse files Browse the repository at this point in the history
These started surfacing in recent rustc versions
  • Loading branch information
tarcieri committed May 28, 2024
1 parent 4d3dd07 commit 4ecbcc7
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 14 deletions.
4 changes: 2 additions & 2 deletions k256/src/arithmetic/field.rs
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ impl Neg for &FieldElement {

impl Sum for FieldElement {
fn sum<I: Iterator<Item = Self>>(iter: I) -> Self {
iter.reduce(core::ops::Add::add).unwrap_or(Self::ZERO)
iter.reduce(Add::add).unwrap_or(Self::ZERO)
}
}

Expand All @@ -498,7 +498,7 @@ impl<'a> Sum<&'a FieldElement> for FieldElement {

impl Product for FieldElement {
fn product<I: Iterator<Item = Self>>(iter: I) -> Self {
iter.reduce(core::ops::Mul::mul).unwrap_or(Self::ONE)
iter.reduce(Mul::mul).unwrap_or(Self::ONE)
}
}

Expand Down
4 changes: 2 additions & 2 deletions k256/src/arithmetic/scalar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,7 @@ impl ReduceNonZero<U512> for Scalar {

impl Sum for Scalar {
fn sum<I: Iterator<Item = Self>>(iter: I) -> Self {
iter.reduce(core::ops::Add::add).unwrap_or(Self::ZERO)
iter.reduce(Add::add).unwrap_or(Self::ZERO)
}
}

Expand All @@ -725,7 +725,7 @@ impl<'a> Sum<&'a Scalar> for Scalar {

impl Product for Scalar {
fn product<I: Iterator<Item = Self>>(iter: I) -> Self {
iter.reduce(core::ops::Mul::mul).unwrap_or(Self::ONE)
iter.reduce(Mul::mul).unwrap_or(Self::ONE)
}
}

Expand Down
4 changes: 2 additions & 2 deletions p256/src/arithmetic/field.rs
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ impl Neg for &FieldElement {

impl Sum for FieldElement {
fn sum<I: Iterator<Item = Self>>(iter: I) -> Self {
iter.reduce(core::ops::Add::add).unwrap_or(Self::ZERO)
iter.reduce(Add::add).unwrap_or(Self::ZERO)
}
}

Expand All @@ -490,7 +490,7 @@ impl<'a> Sum<&'a FieldElement> for FieldElement {

impl Product for FieldElement {
fn product<I: Iterator<Item = Self>>(iter: I) -> Self {
iter.reduce(core::ops::Mul::mul).unwrap_or(Self::ONE)
iter.reduce(Mul::mul).unwrap_or(Self::ONE)
}
}

Expand Down
4 changes: 2 additions & 2 deletions p256/src/arithmetic/scalar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -676,7 +676,7 @@ impl ReduceNonZero<U256> for Scalar {

impl Sum for Scalar {
fn sum<I: Iterator<Item = Self>>(iter: I) -> Self {
iter.reduce(core::ops::Add::add).unwrap_or(Self::ZERO)
iter.reduce(Add::add).unwrap_or(Self::ZERO)
}
}

Expand All @@ -688,7 +688,7 @@ impl<'a> Sum<&'a Scalar> for Scalar {

impl Product for Scalar {
fn product<I: Iterator<Item = Self>>(iter: I) -> Self {
iter.reduce(core::ops::Mul::mul).unwrap_or(Self::ONE)
iter.reduce(Mul::mul).unwrap_or(Self::ONE)
}
}

Expand Down
4 changes: 2 additions & 2 deletions p521/src/arithmetic/field.rs
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,7 @@ impl Neg for FieldElement {

impl Sum for FieldElement {
fn sum<I: Iterator<Item = Self>>(iter: I) -> Self {
iter.reduce(core::ops::Add::add).unwrap_or(Self::ZERO)
iter.reduce(Add::add).unwrap_or(Self::ZERO)
}
}

Expand All @@ -626,7 +626,7 @@ impl<'a> Sum<&'a FieldElement> for FieldElement {

impl Product for FieldElement {
fn product<I: Iterator<Item = Self>>(iter: I) -> Self {
iter.reduce(core::ops::Mul::mul).unwrap_or(Self::ONE)
iter.reduce(Mul::mul).unwrap_or(Self::ONE)
}
}

Expand Down
8 changes: 4 additions & 4 deletions p521/src/arithmetic/scalar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use self::scalar_impl::*;
use crate::{FieldBytes, NistP521, SecretKey, U576};
use core::{
iter::{Product, Sum},
ops::{AddAssign, MulAssign, Neg, Shr, ShrAssign, SubAssign},
ops::{Add, AddAssign, Mul, MulAssign, Neg, Shr, ShrAssign, SubAssign},
};
use elliptic_curve::{
array::Array,
Expand All @@ -43,7 +43,7 @@ use {crate::ScalarBits, elliptic_curve::group::ff::PrimeFieldBits};
use serdect::serde::{de, ser, Deserialize, Serialize};

#[cfg(doc)]
use core::ops::{Add, Mul, Sub};
use core::ops::Sub;

#[cfg(target_pointer_width = "32")]
use super::util::{u32x18_to_u64x9, u64x9_to_u32x18};
Expand Down Expand Up @@ -474,7 +474,7 @@ impl Neg for Scalar {

impl Sum for Scalar {
fn sum<I: Iterator<Item = Self>>(iter: I) -> Self {
iter.reduce(core::ops::Add::add).unwrap_or(Self::ZERO)
iter.reduce(Add::add).unwrap_or(Self::ZERO)
}
}

Expand All @@ -486,7 +486,7 @@ impl<'a> Sum<&'a Scalar> for Scalar {

impl Product for Scalar {
fn product<I: Iterator<Item = Self>>(iter: I) -> Self {
iter.reduce(core::ops::Mul::mul).unwrap_or(Self::ONE)
iter.reduce(Mul::mul).unwrap_or(Self::ONE)
}
}

Expand Down
2 changes: 2 additions & 0 deletions primefield/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,7 @@ macro_rules! impl_mont_field_element_arithmetic {
}

impl Sum for $fe {
#[allow(unused_qualifications)]
fn sum<I: Iterator<Item = Self>>(iter: I) -> Self {
iter.reduce(core::ops::Add::add).unwrap_or(Self::ZERO)
}
Expand All @@ -464,6 +465,7 @@ macro_rules! impl_mont_field_element_arithmetic {
}

impl Product for $fe {
#[allow(unused_qualifications)]
fn product<I: Iterator<Item = Self>>(iter: I) -> Self {
iter.reduce(core::ops::Mul::mul).unwrap_or(Self::ONE)
}
Expand Down
2 changes: 2 additions & 0 deletions primeorder/src/field.rs
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,7 @@ macro_rules! impl_mont_field_element_arithmetic {
}

impl Sum for $fe {
#[allow(unused_qualifications)]
fn sum<I: Iterator<Item = Self>>(iter: I) -> Self {
iter.reduce(core::ops::Add::add).unwrap_or(Self::ZERO)
}
Expand All @@ -454,6 +455,7 @@ macro_rules! impl_mont_field_element_arithmetic {
}

impl Product for $fe {
#[allow(unused_qualifications)]
fn product<I: Iterator<Item = Self>>(iter: I) -> Self {
iter.reduce(core::ops::Mul::mul).unwrap_or(Self::ONE)
}
Expand Down

0 comments on commit 4ecbcc7

Please sign in to comment.