Skip to content

Commit 60e0345

Browse files
committed
Fix op_ref warning
Compare rust-lang/rust-clippy#2597
1 parent a5c2685 commit 60e0345

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

bignum/src/lib.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -530,17 +530,17 @@ where
530530
for<'a1, 'a2> &'a1 T: NumOps<&'a2 T, T>,
531531
{
532532
fn ceil_quotient(&self, k: &Self) -> Self {
533-
assert!(k > &Self::zero());
533+
assert!(*k > Self::zero());
534534
&(&(self + k) - &Self::one()) / k
535535
}
536536

537537
fn floor_quotient(&self, k: &Self) -> Self {
538-
assert!(k > &Self::zero());
538+
assert!(*k > Self::zero());
539539
self / k
540540
}
541541

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

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

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

556556
let one = Self::one();

dsa/src/lib.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#![cfg_attr(feature="cargo-clippy", feature(tool_lints))]
2-
31
extern crate bignum;
42
extern crate num_traits;
53
extern crate rsa;
@@ -44,13 +42,12 @@ where
4442
self.secret_key_from_k(m1, s1, &k)
4543
}
4644

47-
#[cfg_attr(feature = "cargo-clippy", allow(clippy::op_ref))]
4845
pub fn verify_signature(&self, m: &T, &Signature { ref r, ref s }: &Signature<T>) -> bool {
4946
let zero = T::zero();
5047
let p = &self.params.p;
5148
let q = &self.params.q;
5249
let g = &self.params.g;
53-
if r <= &zero || r >= q || s <= &zero || s >= q {
50+
if *r <= zero || r >= q || *s <= zero || s >= q {
5451
return false;
5552
}
5653
let w = T::invmod(s, q).unwrap();

0 commit comments

Comments
 (0)