Skip to content

Commit 769cd6d

Browse files
committed
Do not check for < 0 for usize types
Clippy emits: error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false The vars `k` and `thresh` are both of type `uszie` and can never be below zero, use `==` instead.
1 parent 289a1a8 commit 769cd6d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/policy/concrete.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ impl<Pk: MiniscriptKey> Policy<Pk> {
341341
}
342342
}
343343
Policy::Threshold(k, ref subs) => {
344-
if k <= 0 || k > subs.len() {
344+
if k == 0 || k > subs.len() {
345345
Err(PolicyError::IncorrectThresh)
346346
} else {
347347
subs.iter()
@@ -619,7 +619,7 @@ where
619619
}
620620

621621
let thresh = expression::parse_num(top.args[0].name)?;
622-
if thresh >= nsubs || thresh <= 0 {
622+
if thresh >= nsubs || thresh == 0 {
623623
return Err(Error::PolicyError(PolicyError::IncorrectThresh));
624624
}
625625

0 commit comments

Comments
 (0)