Skip to content

Commit 5af2177

Browse files
misc code cleanups
1 parent 6d37120 commit 5af2177

File tree

5 files changed

+8
-6
lines changed

5 files changed

+8
-6
lines changed

src/polynomial.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1237,7 +1237,7 @@ impl<T: PolynomialCoefficient> Polynomial<T> {
12371237
T: GCD<Output = T> + PartialOrd,
12381238
{
12391239
if let Some(mut retval) = self.iter().fold(None, |lhs: Option<T>, rhs| match lhs {
1240-
None => Some(rhs.clone()),
1240+
None => Some(rhs),
12411241
Some(lhs) => Some(lhs.gcd(&rhs)),
12421242
}) {
12431243
let c = self

src/polynomial/div_rem.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,11 @@ impl<'a, T: PolynomialCoefficient + for<'b> ExactDiv<&'b T, Output = T>> ExactDi
470470
}
471471

472472
impl<T: PolynomialDivSupported> Polynomial<T> {
473-
pub fn checked_powmod<E: Clone + Integer>(&self, exponent: E, modulus: &Self) -> Option<Self> {
473+
pub fn checked_powmod<E: Clone + Integer>(
474+
&self,
475+
mut exponent: E,
476+
modulus: &Self,
477+
) -> Option<Self> {
474478
if exponent < Zero::zero() {
475479
return None;
476480
}
@@ -481,7 +485,6 @@ impl<T: PolynomialDivSupported> Polynomial<T> {
481485
if exponent.is_one() {
482486
return Some(base);
483487
}
484-
let mut exponent = exponent.clone();
485488
let mut retval: Option<Self> = None;
486489
loop {
487490
if exponent.is_odd() {

src/polynomial/same_degree_factorization.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ where
5454
.to_bigint()
5555
.expect("can't convert modulus/characteristic to BigInt");
5656
let polynomial_exponent = (bigint_characteristic.pow(factor_degree) - 1u32) / 2u32;
57-
let coefficient_uniform = Uniform::new(V::zero(), characteristic.clone());
57+
let coefficient_uniform = Uniform::new(V::zero(), characteristic);
5858
let mut retval = Vec::new();
5959
let mut factoring_stack = vec![self.clone()];
6060
while let Some(mut polynomial) = factoring_stack.pop() {

src/traits.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,6 @@ pub trait ExactDivAssign<Rhs = Self>: ExactDiv<Rhs, Output = Self> {
560560
panic!("exact division failed");
561561
}
562562
}
563-
#[must_use]
564563
fn checked_exact_div_assign(&mut self, rhs: Rhs) -> Result<(), ()>;
565564
}
566565

src/util.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,7 @@ pub trait IsPseudoPrime:
634634
return false;
635635
}
636636
let sqrt = self.sqrt();
637-
if sqrt.clone() * sqrt.clone() == *self {
637+
if sqrt.clone() * sqrt == *self {
638638
return false;
639639
}
640640
if let Some(value) = self.to_u128() {

0 commit comments

Comments
 (0)