Skip to content

Commit

Permalink
Fix op_ref warning
Browse files Browse the repository at this point in the history
  • Loading branch information
aopicier committed Sep 16, 2018
1 parent a5c2685 commit 60e0345
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
8 changes: 4 additions & 4 deletions bignum/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -530,17 +530,17 @@ where
for<'a1, 'a2> &'a1 T: NumOps<&'a2 T, T>,
{
fn ceil_quotient(&self, k: &Self) -> Self {
assert!(k > &Self::zero());
assert!(*k > Self::zero());
&(&(self + k) - &Self::one()) / k
}

fn floor_quotient(&self, k: &Self) -> Self {
assert!(k > &Self::zero());
assert!(*k > Self::zero());
self / k
}

fn remainder(&self, k: &Self) -> Self {
assert!(k > &Self::zero());
assert!(*k > Self::zero());

let mut r = self % k;
if r < Self::zero() {
Expand All @@ -550,7 +550,7 @@ where
}

fn root(&self, k: usize) -> (Self, bool) {
assert!(self > &Self::zero(), "base is not positive");
assert!(*self > Self::zero(), "base is not positive");
assert!(k > 0, "exponent is not positive");

let one = Self::one();
Expand Down
5 changes: 1 addition & 4 deletions dsa/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![cfg_attr(feature="cargo-clippy", feature(tool_lints))]

extern crate bignum;
extern crate num_traits;
extern crate rsa;
Expand Down Expand Up @@ -44,13 +42,12 @@ where
self.secret_key_from_k(m1, s1, &k)
}

#[cfg_attr(feature = "cargo-clippy", allow(clippy::op_ref))]
pub fn verify_signature(&self, m: &T, &Signature { ref r, ref s }: &Signature<T>) -> bool {
let zero = T::zero();
let p = &self.params.p;
let q = &self.params.q;
let g = &self.params.g;
if r <= &zero || r >= q || s <= &zero || s >= q {
if *r <= zero || r >= q || *s <= zero || s >= q {
return false;
}
let w = T::invmod(s, q).unwrap();
Expand Down

0 comments on commit 60e0345

Please sign in to comment.